diff options
author | Alex Blasche <alexander.blasche@qt.io> | 2018-10-30 16:56:38 +0100 |
---|---|---|
committer | Jani Heikkinen <jani.heikkinen@qt.io> | 2018-10-31 08:19:38 +0000 |
commit | c2b510909dc8839ff6578086051a22e8b21462e3 (patch) | |
tree | 6e9d89fc5139826a28f1f10b03919ffd758a949b /src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp | |
parent | 8d279a05f2570ae1b964c90efd9a5bf2ce154b76 (diff) |
Ensure QObject context is retained to avoid crashesv5.12.0-beta4
If the public class is deleted pending lambda invocation can cause
crashes unless QObject context is provided. This fixes a regression
introduced by 819bb06c2cb3372cb1bb9ddd7f3a504f78d3452d.
This was discovered while investigating QTBUG-71479.
Change-Id: I3a49916ce6d9425c684863bb0b04a10bd3e652b9
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Diffstat (limited to 'src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp')
-rw-r--r-- | src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp b/src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp index dbd084ed..e16caff6 100644 --- a/src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp +++ b/src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp @@ -129,7 +129,7 @@ void QBluetoothServiceDiscoveryAgentPrivate::start(const QBluetoothAddress &addr QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(deviceObjectPath, q); watcher->setProperty("_q_BTaddress", QVariant::fromValue(address)); QObject::connect(watcher, &QDBusPendingCallWatcher::finished, - [this](QDBusPendingCallWatcher *watcher){ + q, [this](QDBusPendingCallWatcher *watcher){ this->_q_foundDevice(watcher); }); } @@ -216,7 +216,7 @@ void QBluetoothServiceDiscoveryAgentPrivate::runExternalSdpScan( sdpScannerProcess->setProgram(fileInfo.canonicalFilePath()); q->connect(sdpScannerProcess, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), - [this](int exitCode, QProcess::ExitStatus status){ + q, [this](int exitCode, QProcess::ExitStatus status){ this->_q_sdpScannerDone(exitCode, status); }); } @@ -396,7 +396,7 @@ void QBluetoothServiceDiscoveryAgentPrivate::_q_foundDevice(QDBusPendingCallWatc watcher = new QDBusPendingCallWatcher(deviceObjectPath, q); watcher->setProperty("_q_BTaddress", QVariant::fromValue(address)); QObject::connect(watcher, &QDBusPendingCallWatcher::finished, - [this](QDBusPendingCallWatcher *watcher){ + q, [this](QDBusPendingCallWatcher *watcher){ this->_q_createdDevice(watcher); }); @@ -537,7 +537,7 @@ void QBluetoothServiceDiscoveryAgentPrivate::discoverServices(const QString &dev QDBusPendingReply<ServiceMap> discoverReply = device->DiscoverServices(pattern); QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(discoverReply, q); QObject::connect(watcher, &QDBusPendingCallWatcher::finished, - [this](QDBusPendingCallWatcher *watcher){ + q, [this](QDBusPendingCallWatcher *watcher){ this->_q_discoveredServices(watcher); }); } |