diff options
Diffstat (limited to 'src/corelib/kernel/qeventdispatcher_win.cpp')
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_win.cpp | 13 |
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(); |