diff options
authorMårten Nordheim <>2019-05-07 17:42:16 +0200
committerMårten Nordheim <>2019-05-08 13:26:03 +0000
commit8adcfa8b240876236f08ad826e6d77ff1f5e9a96 (patch)
parenta1516c3b93174af25fe2bb4fe7f1ec1973cebe81 (diff)
WinRT: Fix crash in native socket engine during close
Make sure "this" still exists when we're done sending the readNotification. The crash manifested itself when connecting to certain websites as they would reply with status 403, then close the connection. On our end we would then handle this "remote host closed" followed by handling the data we received. The http code handles the data successfully and sees we are done and there is nothing more to do, so it closes the connection. Which leads to closing QAbstractSocket, which closes native socket again and then deletes it. Fixes: QTBUG-75620 Change-Id: I233c67f359aa8234f1a2c4ea9463108b08c9165f Reviewed-by: Oliver Wolff <>
1 files changed, 7 insertions, 1 deletions
diff --git a/src/network/socket/qnativesocketengine_winrt.cpp b/src/network/socket/qnativesocketengine_winrt.cpp
index 7ac6297de6..2eb2141fee 100644
--- a/src/network/socket/qnativesocketengine_winrt.cpp
+++ b/src/network/socket/qnativesocketengine_winrt.cpp
@@ -875,8 +875,14 @@ void QNativeSocketEngine::close()
if (d->closingDown)
- if (d->pendingReadNotification)
+ if (d->pendingReadNotification) {
+ // We use QPointer here to see if this QNativeSocketEngine was deleted as a result of
+ // finishing and cleaning up a network request when calling "processReadReady".
+ QPointer<QNativeSocketEngine> alive(this);
+ if (alive.isNull())
+ return;
+ }
d->closingDown = true;