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
Pick-to: 6.2 6.1
Change-Id: I0740bf22e8d1cb0e8b4eba7fc1a27ffe669973ff
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
Alex Trotsenko 2021-06-15 13:05:49 +03:00
parent f10491a9af
commit fe6d84d96e

View File

@ -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();