summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOliver Wolff <oliver.wolff@qt.io>2019-10-10 15:15:53 +0200
committerOliver Wolff <oliver.wolff@qt.io>2019-10-11 14:11:28 +0200
commit245f19122c2a6a112a35ee65556bcf00b6545d87 (patch)
tree03b701a54be3dd25550d9a7b18cecdccdb2adc7e /src
parent7390de230e3c86049824bef756e4af623a547d61 (diff)
qbluetoothdevicediscoveryagent_winrt: Decrement device count in case of failure
It is possible that obtaining a paired device inside the callback fails, if the device was paired to another than the currently active bluetooth adapter. If we do not decrement the to be detected device count, the scan will never finish. Change-Id: I86140d082891482c759f33888b2483f3f5821253 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp b/src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp
index ae8e9184..30aa3fcc 100644
--- a/src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp
+++ b/src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp
@@ -440,8 +440,11 @@ void QWinRTBluetoothDeviceDiscoveryWorker::classicBluetoothInfoFromDeviceIdAsync
hr = deviceFromIdOperation->put_Completed(Callback<IAsyncOperationCompletedHandler<BluetoothDevice *>>
([thisPointer](IAsyncOperation<BluetoothDevice *> *op, AsyncStatus status)
{
- if (status == Completed && thisPointer)
- thisPointer->onPairedClassicBluetoothDeviceFoundAsync(op, status);
+ if (thisPointer) {
+ if (status == Completed)
+ thisPointer->onPairedClassicBluetoothDeviceFoundAsync(op, status);
+ --thisPointer->m_pendingPairedDevices;
+ }
return S_OK;
}).Get());
if (FAILED(hr)) {
@@ -474,8 +477,11 @@ void QWinRTBluetoothDeviceDiscoveryWorker::leBluetoothInfoFromDeviceIdAsync(HSTR
hr = deviceFromIdOperation->put_Completed(Callback<IAsyncOperationCompletedHandler<BluetoothLEDevice *>>
([thisPointer] (IAsyncOperation<BluetoothLEDevice *> *op, AsyncStatus status)
{
- if (status == Completed && thisPointer)
- thisPointer->onPairedBluetoothLEDeviceFoundAsync(op, status);
+ if (thisPointer) {
+ if (status == Completed)
+ thisPointer->onPairedBluetoothLEDeviceFoundAsync(op, status);
+ --thisPointer->m_pendingPairedDevices;
+ }
return S_OK;
}).Get());
if (FAILED(hr)) {