From: Alex Henrie Subject: [PATCH 2/2] user32: Check for PeekMessage failure in MENU_SuspendPopup. Message-Id: <20161103020205.25809-2-alexhenrie24@gmail.com> Date: Wed, 2 Nov 2016 20:01:35 -0600 In-Reply-To: <20161103020205.25809-1-alexhenrie24@gmail.com> References: <20161103020205.25809-1-alexhenrie24@gmail.com> 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 --- 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