summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlex Trotsenko <alex1973tr@gmail.com>2021-06-15 13:05:49 +0300
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-06-18 23:44:32 +0000
commit2e0af2bc10a5c2d2a06b6eb7b2a0ef0bc5eb059e (patch)
treeac12bdae68fa48c80f3463d2c6f0aeaf5c588bd5 /src
parent2f8572dd3b5781b1e4c4d627ae74172ac8ac3c19 (diff)
QEventDispatcherWin32: suppress old {FD_CLOSE|FD_CONNECT} notifications
As with other network events, we must also ignore these notifications until WM_QT_ACTIVATENOTIFIERS message is received. Fixes: QTBUG-82835 Change-Id: I0740bf22e8d1cb0e8b4eba7fc1a27ffe669973ff Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io> (cherry picked from commit fe6d84d96e67113846801803c3ba1f20b26e123f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/kernel/qeventdispatcher_win.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp
index 80297feef1..28099cda9f 100644
--- a/src/corelib/kernel/qeventdispatcher_win.cpp
+++ b/src/corelib/kernel/qeventdispatcher_win.cpp
@@ -622,9 +622,16 @@ void QEventDispatcherWin32::registerSocketNotifier(QSocketNotifier *notifier)
}
sd.event |= event;
} else {
- // Disable the events which could be implicitly re-enabled. Next activation
- // of socket notifiers will reset the mask.
- d->active_fd.insert(sockfd, QSockFd(event, FD_READ | FD_ACCEPT | FD_WRITE | FD_OOB));
+ // Although WSAAsyncSelect(..., 0), which is called from
+ // unregisterSocketNotifier(), immediately disables event message
+ // posting for the socket, it is possible that messages could be
+ // waiting in the application message queue even if the socket was
+ // closed. Also, some events could be implicitly re-enabled due
+ // to system calls. Ignore these superfluous events until all
+ // pending notifications have been suppressed. Next activation of
+ // socket notifiers will reset the mask.
+ d->active_fd.insert(sockfd, QSockFd(event, FD_READ | FD_CLOSE | FD_ACCEPT | FD_WRITE
+ | FD_CONNECT | FD_OOB));
}
d->postActivateSocketNotifiers();