[PATCH 2/2] user32: Check for PeekMessage failure in MENU_SuspendPopup.

Alex Henrie alexhenrie24 at gmail.com
Wed Nov 2 21:01:35 CDT 2016


Fixes https://bugs.winehq.org/show_bug.cgi?id=41508

The entire MENU_SuspendPopup function is just an optimization to try to
improve performance if the left or right arrow key is held down. If the
next message is not recognized, it should be processed and removed
normally, without optimization.

Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
---
 dlls/user32/menu.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/dlls/user32/menu.c b/dlls/user32/menu.c
index 1398d38..69c8ab0 100644
--- a/dlls/user32/menu.c
+++ b/dlls/user32/menu.c
@@ -2812,7 +2812,9 @@ static BOOL MENU_SuspendPopup( MTRACKER* pmt )
 
     msg.hwnd = pmt->hOwnerWnd;
 
-    PeekMessageW( &msg, 0, WM_KEYDOWN, WM_KEYDOWN, PM_NOYIELD | PM_REMOVE );
+    if( !PeekMessageW( &msg, 0, WM_KEYDOWN, WM_KEYDOWN, PM_NOYIELD | PM_REMOVE ) )
+        goto fail;
+
     pmt->trackFlags |= TF_SKIPREMOVE;
 
     PeekMessageW( &msg, 0, 0, 0, PM_NOYIELD | PM_NOREMOVE );
@@ -2828,6 +2830,7 @@ static BOOL MENU_SuspendPopup( MTRACKER* pmt )
         }
     }
 
+fail:
     /* failures go through this */
     pmt->trackFlags &= ~TF_SUSPENDPOPUP;
     return FALSE;
-- 
2.10.2




More information about the wine-patches mailing list