From df376c4c27d16f70ba69925553acfc69287b269a Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Fri, 26 Jan 2018 11:54:55 +0100 Subject: 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 Reviewed-by: Oliver Wolff --- src/bluetooth/qbluetoothsocket_winrt.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/bluetooth/qbluetoothsocket_winrt.cpp') 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 @@ -125,6 +125,9 @@ public: } ~SocketWorker() + { + } + void close() { if (Q_UNLIKELY(m_initialReadOp)) { ComPtr 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) { -- cgit v1.2.3