summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/qbluetoothlocaldevice_bluez.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>2012-01-03 14:38:11 +0100
committerQt by Nokia <qt-info@nokia.com>2012-01-03 23:45:06 +0100
commit91371ffd3d00e10635f58d1e9efe8c1b3f467537 (patch)
tree50a6b7f885721b6db2c0a8fcbb2a547e216102fb /src/bluetooth/qbluetoothlocaldevice_bluez.cpp
parent3336383132b1aafeb74585d203e98e85811af55e (diff)
QtConnectivity: Fix test crashes/asserts/hangs.
- Fix crash caused by uninitialized d-ptr in local device default implementation (Windows). - Fix crash caused by uninitialized d-ptr in local device bluez implementation (Linux) if connection fails. - Verify local device validity before d-ptr is accessed in test - Fix crash in QNdefNfcUriRecord::uri() in case abbreviations[0] (==0) is accessed. - Terminate wait loops - Check signal spy before accessing first element. - Fix compiler warnings. Change-Id: I92d54b4dfcc05e8befb49f2bd72b60251641aa48 Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Alex <alex.blasche@nokia.com>
Diffstat (limited to 'src/bluetooth/qbluetoothlocaldevice_bluez.cpp')
-rw-r--r--src/bluetooth/qbluetoothlocaldevice_bluez.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/bluetooth/qbluetoothlocaldevice_bluez.cpp b/src/bluetooth/qbluetoothlocaldevice_bluez.cpp
index 9b01b8fc..17569ecb 100644
--- a/src/bluetooth/qbluetoothlocaldevice_bluez.cpp
+++ b/src/bluetooth/qbluetoothlocaldevice_bluez.cpp
@@ -55,8 +55,8 @@ QTBLUETOOTH_BEGIN_NAMESPACE
static const QLatin1String agentPath("/qt/agent");
-QBluetoothLocalDevice::QBluetoothLocalDevice(QObject *parent)
-: QObject(parent)
+QBluetoothLocalDevice::QBluetoothLocalDevice(QObject *parent) :
+ QObject(parent), d_ptr(0)
{
OrgBluezManagerInterface manager(QLatin1String("org.bluez"), QLatin1String("/"),
QDBusConnection::systemBus());
@@ -90,8 +90,8 @@ QBluetoothLocalDevice::QBluetoothLocalDevice(QObject *parent)
}
-QBluetoothLocalDevice::QBluetoothLocalDevice(const QBluetoothAddress &address, QObject *parent)
-: QObject(parent)
+QBluetoothLocalDevice::QBluetoothLocalDevice(const QBluetoothAddress &address, QObject *parent) :
+ QObject(parent), d_ptr(0)
{
OrgBluezManagerInterface manager(QLatin1String("org.bluez"), QLatin1String("/"),
QDBusConnection::systemBus());
@@ -237,7 +237,10 @@ QList<QBluetoothHostInfo> QBluetoothLocalDevice::allDevices()
return localDevices;
}
-static inline OrgBluezDeviceInterface *getDevice(const QBluetoothAddress &address, QBluetoothLocalDevicePrivate *d_ptr){
+static inline OrgBluezDeviceInterface *getDevice(const QBluetoothAddress &address, QBluetoothLocalDevicePrivate *d_ptr)
+{
+ if (!d_ptr)
+ return 0;
QDBusPendingReply<QDBusObjectPath> reply = d_ptr->adapter->FindDevice(address.toString());
reply.waitForFinished();
if(reply.isError()){