summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bluetooth/qbluetoothdevicediscoveryagent_android.cpp3
-rw-r--r--src/bluetooth/qbluetoothservicediscoveryagent.cpp8
2 files changed, 11 insertions, 0 deletions
diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent_android.cpp b/src/bluetooth/qbluetoothdevicediscoveryagent_android.cpp
index ed6507f3..7e8e4236 100644
--- a/src/bluetooth/qbluetoothdevicediscoveryagent_android.cpp
+++ b/src/bluetooth/qbluetoothdevicediscoveryagent_android.cpp
@@ -225,6 +225,9 @@ void QBluetoothDeviceDiscoveryAgentPrivate::stop()
return;
if (m_active == SDPScanActive) {
+ if (pendingCancel)
+ return;
+
pendingCancel = true;
pendingStart = false;
bool success = adapter.callMethod<jboolean>("cancelDiscovery");
diff --git a/src/bluetooth/qbluetoothservicediscoveryagent.cpp b/src/bluetooth/qbluetoothservicediscoveryagent.cpp
index 7daab4b7..d6163f0e 100644
--- a/src/bluetooth/qbluetoothservicediscoveryagent.cpp
+++ b/src/bluetooth/qbluetoothservicediscoveryagent.cpp
@@ -450,6 +450,10 @@ void QBluetoothServiceDiscoveryAgentPrivate::startDeviceDiscovery()
*/
void QBluetoothServiceDiscoveryAgentPrivate::stopDeviceDiscovery()
{
+ // disconnect to avoid recursion during stop() - QTBUG-60131
+ // we don't care about a potential signals from device discovery agent anymore
+ deviceDiscoveryAgent->disconnect();
+
deviceDiscoveryAgent->stop();
delete deviceDiscoveryAgent;
deviceDiscoveryAgent = 0;
@@ -497,6 +501,10 @@ void QBluetoothServiceDiscoveryAgentPrivate::_q_deviceDiscoveryError(QBluetoothD
error = static_cast<QBluetoothServiceDiscoveryAgent::Error>(newError);
errorString = deviceDiscoveryAgent->errorString();
+ // disconnect to avoid recursion during stop() - QTBUG-60131
+ // we don't care about a potential signals from device discovery agent anymore
+ deviceDiscoveryAgent->disconnect();
+
deviceDiscoveryAgent->stop();
delete deviceDiscoveryAgent;
deviceDiscoveryAgent = 0;