]> asedeno.scripts.mit.edu Git - PuTTY_svn.git/commitdiff
Replace GetQueueStatus with PeekMessage(PM_NOREMOVE).
authorSimon Tatham <anakin@pobox.com>
Mon, 11 Nov 2013 23:01:47 +0000 (23:01 +0000)
committerSimon Tatham <anakin@pobox.com>
Mon, 11 Nov 2013 23:01:47 +0000 (23:01 +0000)
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.

git-svn-id: http://svn.tartarus.org/sgt/putty@10057 cda61777-01e9-0310-a592-d414129be87e

windows/window.c

index 6baa45a79e95658bd0c3a2081858b45557c77a41..38c31dd4015e6b9a2ada8a2c160ff28022166825 100644 (file)
@@ -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