From 5d2de060979e7c9f72c95837130c53d35c99d826 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Mon, 11 Nov 2013 23:01:47 +0000 Subject: [PATCH] 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. git-svn-id: http://svn.tartarus.org/sgt/putty@10057 cda61777-01e9-0310-a592-d414129be87e --- windows/window.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/windows/window.c b/windows/window.c index 6baa45a7..38c31dd4 100644 --- a/windows/window.c +++ b/windows/window.c @@ -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 -- 2.45.2