diff options
author | Andy Shaw <andy.shaw@qt.io> | 2018-01-26 11:54:55 +0100 |
---|---|---|
committer | Andy Shaw <andy.shaw@qt.io> | 2018-01-26 13:31:15 +0000 |
commit | df376c4c27d16f70ba69925553acfc69287b269a (patch) | |
tree | 403941fd89f999b104f0e717cb175067b47b89c3 | |
parent | dd2e19ca327a3f7a49c40b61c483ec60dcaafa90 (diff) | |
download | qtconnectivity-df376c4c27d16f70ba69925553acfc69287b269a.tar.gz |
Windows: Cancel and close the operation before deleting the SocketWorker
Since it is possible that after calling Cancel() on the IAsyncInfo that
it will still call the Completed() callback, we need to ensure that
it has a chance to process the pending events before it is deleted.
Change-Id: I7d6fbb5bf6344098048b147c9d361c1fe7923b55
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
-rw-r--r-- | src/bluetooth/qbluetoothsocket_winrt.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/bluetooth/qbluetoothsocket_winrt.cpp b/src/bluetooth/qbluetoothsocket_winrt.cpp index 17eeb195..1faebf69 100644 --- a/src/bluetooth/qbluetoothsocket_winrt.cpp +++ b/src/bluetooth/qbluetoothsocket_winrt.cpp @@ -126,6 +126,9 @@ public: ~SocketWorker() { + } + void close() + { if (Q_UNLIKELY(m_initialReadOp)) { ComPtr<IAsyncInfo> info; HRESULT hr = m_initialReadOp.As(&info); @@ -402,6 +405,7 @@ void QBluetoothSocketPrivate::abort() this, &QBluetoothSocketPrivate::handleNewData); disconnect(m_worker, &SocketWorker::socketErrorOccured, this, &QBluetoothSocketPrivate::handleError); + m_worker->close(); m_worker->deleteLater(); if (socket != -1) { |