summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/qbluetoothservicediscoveryagent_p.h
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@theqtcompany.com>2015-01-26 08:47:06 +0100
committerJani Heikkinen <jani.heikkinen@theqtcompany.com>2015-01-29 09:32:08 +0000
commit9cc6a9b3af559004bbfdfec3aa7dd258bee1eb77 (patch)
treef632da853067c7dc01b134fb7ba8b0e4550e1d3d /src/bluetooth/qbluetoothservicediscoveryagent_p.h
parent4706708254176ca2b971a709697d0e8c77f55974 (diff)
Fix crashing btchat example when selecting remote devicev5.4.1
The example immidiately destroys the QBluetoothServiceDiscoveryAgent when the user selects a remote chat service from the remote selector dialog. This may happen even when the scheduled QtConcurrent call to runSdpScan() was still pending. The subsequent signal callback into the deleted parent caused a crash. Unfortunately QtConcurrent::run() returns a QFuture which does not permit stopping the pending thread execution. Therefore the runSdpScan() had to be rewritten using QProcess to properly destruct pending calls. Change-Id: I1ed5e147feb94a26240901a02d836056eddabbf6 Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'src/bluetooth/qbluetoothservicediscoveryagent_p.h')
-rw-r--r--src/bluetooth/qbluetoothservicediscoveryagent_p.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/bluetooth/qbluetoothservicediscoveryagent_p.h b/src/bluetooth/qbluetoothservicediscoveryagent_p.h
index ea985627..3b9c0a42 100644
--- a/src/bluetooth/qbluetoothservicediscoveryagent_p.h
+++ b/src/bluetooth/qbluetoothservicediscoveryagent_p.h
@@ -58,6 +58,7 @@ class OrgBluezManagerInterface;
class OrgBluezAdapterInterface;
class OrgBluezDeviceInterface;
class OrgFreedesktopDBusObjectManagerInterface;
+#include <QtCore/qprocess.h>
QT_BEGIN_NAMESPACE
class QDBusPendingCallWatcher;
@@ -127,6 +128,7 @@ public:
void _q_discoverGattCharacteristics(QDBusPendingCallWatcher *watcher);
void _q_discoveredGattCharacteristic(QDBusPendingCallWatcher *watcher);
*/
+ void _q_sdpScannerDone(int exitCode, QProcess::ExitStatus status);
void _q_finishSdpScan(QBluetoothServiceDiscoveryAgent::Error errorCode,
const QString &errorDescription,
const QStringList &xmlRecords);
@@ -147,8 +149,9 @@ private:
#ifdef QT_BLUEZ_BLUETOOTH
void startBluez5(const QBluetoothAddress &address);
- void runSdpScan(const QBluetoothAddress &remoteAddress,
+ void runExternalSdpScan(const QBluetoothAddress &remoteAddress,
const QBluetoothAddress localAddress);
+ void sdpScannerDone(int exitCode, QProcess::ExitStatus exitStatus);
QVariant readAttributeValue(QXmlStreamReader &xml);
QBluetoothServiceInfo parseServiceXml(const QString& xml);
void performMinimalServiceDiscovery(const QBluetoothAddress &deviceAddress);
@@ -195,6 +198,7 @@ private:
OrgFreedesktopDBusObjectManagerInterface *managerBluez5;
OrgBluezAdapterInterface *adapter;
OrgBluezDeviceInterface *device;
+ QProcess *sdpScannerProcess;
#endif
#ifdef QT_ANDROID_BLUETOOTH