summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bluetooth/qbluetoothdevicediscoveryagent_android.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent_android.cpp b/src/bluetooth/qbluetoothdevicediscoveryagent_android.cpp
index f1569266..a1a2ad58 100644
--- a/src/bluetooth/qbluetoothdevicediscoveryagent_android.cpp
+++ b/src/bluetooth/qbluetoothdevicediscoveryagent_android.cpp
@@ -243,15 +243,20 @@ void QBluetoothDeviceDiscoveryAgentPrivate::stop()
{
Q_Q(QBluetoothDeviceDiscoveryAgent);
+ pendingStart = false;
+
if (m_active == NoScanActive)
return;
if (m_active == SDPScanActive) {
- if (pendingCancel)
+ if (pendingCancel) {
+ // If we had both a pending cancel and a pending start,
+ // we now have only a pending cancel.
+ // The pending start was canceled above.
return;
+ }
pendingCancel = true;
- pendingStart = false;
bool success = adapter.callMethod<jboolean>("cancelDiscovery");
if (!success) {
lastError = QBluetoothDeviceDiscoveryAgent::InputOutputError;