summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOliver Wolff <oliver.wolff@qt.io>2018-10-31 11:05:50 +0100
committerOliver Wolff <oliver.wolff@qt.io>2018-11-15 14:37:30 +0000
commit4821972696716f988b4b92f22a9a552be15c5401 (patch)
treed00c215a5d386a45c3c633ba8a63e1c0194f2e05 /src
parentc2b510909dc8839ff6578086051a22e8b21462e3 (diff)
qbluetoothlocaldevice_p.cpp: Make sure d_ptr is initialized
Backends that still use qbluetoothlocaldevce_p.cpp (namely ios and winrt) overload QBluetoothLocalDevicePrivate::isValid. While it does not make a difference for ios (as false is returned if no d_ptr is initialized) local device will be seen as invalid on winrt if there is no d_ptr. Fixes: QTBUG-67090 Change-Id: I82dfa4563be0ed4800f0a8dd2a9ccfc3fe313e3b Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/bluetooth/qbluetoothlocaldevice_p.cpp6
-rw-r--r--src/bluetooth/qbluetoothlocaldevice_p.h29
2 files changed, 10 insertions, 25 deletions
diff --git a/src/bluetooth/qbluetoothlocaldevice_p.cpp b/src/bluetooth/qbluetoothlocaldevice_p.cpp
index b93de6a9..793a8311 100644
--- a/src/bluetooth/qbluetoothlocaldevice_p.cpp
+++ b/src/bluetooth/qbluetoothlocaldevice_p.cpp
@@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE
QBluetoothLocalDevice::QBluetoothLocalDevice(QObject *parent) :
QObject(parent),
- d_ptr(nullptr)
+ d_ptr(new QBluetoothLocalDevicePrivate(this, QBluetoothAddress()))
{
#if !defined(QT_IOS_BLUETOOTH) && !defined(QT_WINRT_BLUETOOTH)
printDummyWarning();
@@ -57,9 +57,9 @@ QBluetoothLocalDevice::QBluetoothLocalDevice(QObject *parent) :
registerQBluetoothLocalDeviceMetaType();
}
-QBluetoothLocalDevice::QBluetoothLocalDevice(const QBluetoothAddress &, QObject *parent) :
+QBluetoothLocalDevice::QBluetoothLocalDevice(const QBluetoothAddress &address, QObject *parent) :
QObject(parent),
- d_ptr(nullptr)
+ d_ptr(new QBluetoothLocalDevicePrivate(this, address))
{
registerQBluetoothLocalDeviceMetaType();
}
diff --git a/src/bluetooth/qbluetoothlocaldevice_p.h b/src/bluetooth/qbluetoothlocaldevice_p.h
index 89dbf9a3..98c62151 100644
--- a/src/bluetooth/qbluetoothlocaldevice_p.h
+++ b/src/bluetooth/qbluetoothlocaldevice_p.h
@@ -208,37 +208,22 @@ private:
void initializeAdapter();
void initializeAdapterBluez5();
};
-#elif defined(QT_WINRT_BLUETOOTH)
+#elif !defined(QT_OSX_BLUETOOTH) // winrt and dummy backend
class QBluetoothLocalDevicePrivate : public QObject
{
public:
- QBluetoothLocalDevicePrivate(QBluetoothLocalDevice *q,
- QBluetoothAddress localAddress = QBluetoothAddress())
- : q_ptr(q)
- {
- Q_UNUSED(localAddress);
- }
-
- ~QBluetoothLocalDevicePrivate()
- {
- }
-
-
- bool isValid() const
+ QBluetoothLocalDevicePrivate(QBluetoothLocalDevice * = nullptr,
+ QBluetoothAddress = QBluetoothAddress())
{
- return true;
}
-private:
- QBluetoothLocalDevice *q_ptr;
-};
-#elif !defined(QT_OSX_BLUETOOTH)
-class QBluetoothLocalDevicePrivate : public QObject
-{
-public:
bool isValid() const
{
+#ifndef QT_WINRT_BLUETOOTH
return false;
+#else
+ return true;
+#endif
}
};
#endif