summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/qbluetoothservicediscoveryagent_osx.mm
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@theqtcompany.com>2016-05-19 18:27:45 +0200
committerEdward Welbourne <edward.welbourne@qt.io>2016-06-02 18:48:16 +0000
commitc347a3748af663da9e8e6ce5e233248b80217f96 (patch)
tree945c756d544f10e0e4591e586c558866632ab53f /src/bluetooth/qbluetoothservicediscoveryagent_osx.mm
parente1a6ad73c5d5c731195967b7f682089da24e1719 (diff)
QBluetoothServiceDiscoveryAgent: set q_ptr in d_ptr's constructor.
The agent class constructors were initializing the q_ptr member of their d_ptr; it is cleaner to pass this down to the d_ptr's constructor and let it do this itself. This also lets Coverity know that initialization actually does happen (CID 22330). In particular, it makes sure we can't leave it uninitialized, if an agent implementation happens to neglect to do so. Change-Id: Ie01046a5a113b5669e8e63c6a22f692cd3943ac0 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'src/bluetooth/qbluetoothservicediscoveryagent_osx.mm')
-rw-r--r--src/bluetooth/qbluetoothservicediscoveryagent_osx.mm16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/bluetooth/qbluetoothservicediscoveryagent_osx.mm b/src/bluetooth/qbluetoothservicediscoveryagent_osx.mm
index 0cf77d9d..c3d4a0e6 100644
--- a/src/bluetooth/qbluetoothservicediscoveryagent_osx.mm
+++ b/src/bluetooth/qbluetoothservicediscoveryagent_osx.mm
@@ -62,7 +62,8 @@ public:
ServiceDiscovery,
};
- QBluetoothServiceDiscoveryAgentPrivate(const QBluetoothAddress &localAddress);
+ QBluetoothServiceDiscoveryAgentPrivate(QBluetoothServiceDiscoveryAgent *qp,
+ const QBluetoothAddress &localAddress);
void startDeviceDiscovery();
void stopDeviceDiscovery();
@@ -110,8 +111,9 @@ private:
OSXBluetooth::ObjCScopedPointer<ObjCServiceInquiry> serviceInquiry;
};
-QBluetoothServiceDiscoveryAgentPrivate::QBluetoothServiceDiscoveryAgentPrivate(const QBluetoothAddress &localAddress) :
- q_ptr(0),
+QBluetoothServiceDiscoveryAgentPrivate::QBluetoothServiceDiscoveryAgentPrivate(
+ QBluetoothServiceDiscoveryAgent *qp, const QBluetoothAddress &localAddress) :
+ q_ptr(qp),
error(QBluetoothServiceDiscoveryAgent::NoError),
singleDevice(false),
localAdapterAddress(localAddress),
@@ -423,15 +425,15 @@ void QBluetoothServiceDiscoveryAgentPrivate::serviceDiscoveryFinished()
}
QBluetoothServiceDiscoveryAgent::QBluetoothServiceDiscoveryAgent(QObject *parent)
-: QObject(parent), d_ptr(new QBluetoothServiceDiscoveryAgentPrivate(QBluetoothAddress()))
+: QObject(parent),
+ d_ptr(new QBluetoothServiceDiscoveryAgentPrivate(this, QBluetoothAddress()))
{
- d_ptr->q_ptr = this;
}
QBluetoothServiceDiscoveryAgent::QBluetoothServiceDiscoveryAgent(const QBluetoothAddress &deviceAdapter, QObject *parent)
-: QObject(parent), d_ptr(new QBluetoothServiceDiscoveryAgentPrivate(deviceAdapter))
+: QObject(parent),
+ d_ptr(new QBluetoothServiceDiscoveryAgentPrivate(this, deviceAdapter))
{
- d_ptr->q_ptr = this;
if (!deviceAdapter.isNull()) {
const QList<QBluetoothHostInfo> localDevices = QBluetoothLocalDevice::allDevices();
foreach (const QBluetoothHostInfo &hostInfo, localDevices) {