Replace GetQueueStatus with PeekMessage(PM_NOREMOVE).

A couple of users report that my recent reworking of the Windows
top-level message loop has led to messages occasionally being lost,
and MsgWaitForMultipleObjects blocking when it ought to have been
called with a zero timeout. I haven't been able to reproduce this
myself, but according to one reporter, PeekMessage(PM_NOREMOVE) is
effective at checking for a non-empty message queue in a way that
GetQueueStatus is not. Switch to using that instead. Thanks to Eric
Flumerfelt for debugging and testing help.

[originally from svn r10057]
This commit is contained in:
Simon Tatham 2013-11-11 23:01:47 +00:00
Родитель 2d9cc79d53
Коммит 94fd7bbf94
1 изменённых файлов: 2 добавлений и 1 удалений

Просмотреть файл

@ -849,7 +849,8 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
int nhandles, n;
DWORD timeout;
if (toplevel_callback_pending() || GetQueueStatus(QS_ALLINPUT)) {
if (toplevel_callback_pending() ||
PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) {
/*
* If we have anything we'd like to do immediately, set
* the timeout for MsgWaitForMultipleObjects to zero so