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.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.cpp')
-rw-r--r-- | src/bluetooth/qbluetoothservicediscoveryagent.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/bluetooth/qbluetoothservicediscoveryagent.cpp b/src/bluetooth/qbluetoothservicediscoveryagent.cpp index 3260d7db..390b9f74 100644 --- a/src/bluetooth/qbluetoothservicediscoveryagent.cpp +++ b/src/bluetooth/qbluetoothservicediscoveryagent.cpp @@ -435,16 +435,16 @@ void QBluetoothServiceDiscoveryAgentPrivate::startDeviceDiscovery() deviceDiscoveryAgent = new QBluetoothDeviceDiscoveryAgent(q); #endif QObject::connect(deviceDiscoveryAgent, &QBluetoothDeviceDiscoveryAgent::finished, - [this](){ + q, [this](){ this->_q_deviceDiscoveryFinished(); }); QObject::connect(deviceDiscoveryAgent, &QBluetoothDeviceDiscoveryAgent::deviceDiscovered, - [this](const QBluetoothDeviceInfo &info){ + q, [this](const QBluetoothDeviceInfo &info){ this->_q_deviceDiscovered(info); }); QObject::connect(deviceDiscoveryAgent, QOverload<QBluetoothDeviceDiscoveryAgent::Error>::of(&QBluetoothDeviceDiscoveryAgent::error), - [this](QBluetoothDeviceDiscoveryAgent::Error newError){ + q, [this](QBluetoothDeviceDiscoveryAgent::Error newError){ this->_q_deviceDiscoveryError(newError); }); } |