diff options
author | Alex Blasche <alexander.blasche@digia.com> | 2015-03-18 15:42:02 +0100 |
---|---|---|
committer | Alex Blasche <alexander.blasche@theqtcompany.com> | 2015-03-23 11:17:04 +0000 |
commit | 3770dcf6dbfadd88c16beaa4d510dc16b519d4b8 (patch) | |
tree | efc1271a3f22e48d9f5783058e9fe6dcd1486c2b /src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp | |
parent | 752de447fe646c20f35b0b304ec2ff737be10ab6 (diff) |
Fix crash in QBluetoothServiceDiscoveryAgent on Bluez 5.x
The list of internally discovered devices was already cleared. It should
not be referenced anymore. Furthermore the QBluetoothSocket is
killed while its internal QBluetoothServiceDiscoveryAgent is still
running. This change stops the agent as well and thereby
prevents more QBluetoothSocket slots froms being invoked and a more
controlled termination of QBluetoothServiceDiscoveryAgent.
[ChangeLog][QtBluetooth][Android] Fixed crash in
QBluetoothServiceDiscoveryAgent on Bluez 5 when using single device
discovery. Single device discovery is used during
QBluetoothSocket::connectToService().
Task-number: QTBUG-44930
Change-Id: Ib3129c492151a3fe12b0c451cf5ffdddc62d001c
Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp')
-rw-r--r-- | src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp b/src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp index 75efa37d..412fd916 100644 --- a/src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp +++ b/src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp @@ -272,7 +272,9 @@ void QBluetoothServiceDiscoveryAgentPrivate::_q_finishSdpScan(QBluetoothServiceD if (errorCode != QBluetoothServiceDiscoveryAgent::NoError) { qCWarning(QT_BT_BLUEZ) << "SDP search failed for" - << discoveredDevices.at(0).address().toString(); + << (!discoveredDevices.isEmpty() + ? discoveredDevices.at(0).address().toString() + : QStringLiteral("<Unknown>")); // We have an error which we need to indicate and stop further processing discoveredDevices.clear(); error = errorCode; |