diff options
Diffstat (limited to 'src/bluetooth/qbluetoothlocaldevice_bluez.cpp')
-rw-r--r-- | src/bluetooth/qbluetoothlocaldevice_bluez.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/bluetooth/qbluetoothlocaldevice_bluez.cpp b/src/bluetooth/qbluetoothlocaldevice_bluez.cpp index 4eb3ca58..c247f679 100644 --- a/src/bluetooth/qbluetoothlocaldevice_bluez.cpp +++ b/src/bluetooth/qbluetoothlocaldevice_bluez.cpp @@ -529,16 +529,20 @@ void QBluetoothLocalDevicePrivate::processPairingBluez5(const QString &objectPat switch (target) { case QBluetoothLocalDevice::Unpaired: { delete pairingTarget; - pairingTarget = 0; + pairingTarget = nullptr; QDBusPendingReply<> removeReply = adapterBluez5->RemoveDevice(QDBusObjectPath(objectPath)); - removeReply.waitForFinished(); - - if (removeReply.isError()) - emit q->error(QBluetoothLocalDevice::PairingError); - else - emit q->pairingFinished(targetAddress, QBluetoothLocalDevice::Unpaired); + auto watcher = new QDBusPendingCallWatcher(removeReply, this); + connect(watcher, &QDBusPendingCallWatcher::finished, + this, [q, targetAddress](QDBusPendingCallWatcher* watcher){ + QDBusPendingReply<> reply = *watcher; + if (reply.isError()) + emit q->error(QBluetoothLocalDevice::PairingError); + else + emit q->pairingFinished(targetAddress, QBluetoothLocalDevice::Unpaired); + watcher->deleteLater(); + }); break; } case QBluetoothLocalDevice::Paired: |