user32/menu: Release menu in HiliteMenuItem() to avoid deadlock.

MENU_SelectItem sends a message, and we must not hold the lock when
that happens

Signed-off-by: Fabian Maurer <dark.shadow4@web.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Fabian Maurer 2018-07-20 16:29:43 +02:00 committed by Alexandre Julliard
parent b6cb27ea4c
commit a9ac425a90
1 changed files with 11 additions and 5 deletions

View File

@ -3859,17 +3859,23 @@ BOOL WINAPI HiliteMenuItem( HWND hWnd, HMENU hMenu, UINT wItemID,
{
POPUPMENU *menu;
UINT pos;
HMENU handle_menu;
UINT focused_item;
TRACE("(%p, %p, %04x, %04x);\n", hWnd, hMenu, wItemID, wHilite);
if (!(menu = find_menu_item(hMenu, wItemID, wHilite, &pos))) return FALSE;
if (menu->FocusedItem != pos)
{
MENU_HideSubPopups( hWnd, menu->obj.handle, FALSE, 0 );
MENU_SelectItem( hWnd, menu->obj.handle, pos, TRUE, 0 );
}
handle_menu = menu->obj.handle;
focused_item = menu->FocusedItem;
release_menu_ptr(menu);
if (focused_item != pos)
{
MENU_HideSubPopups( hWnd, handle_menu, FALSE, 0 );
MENU_SelectItem( hWnd, handle_menu, pos, TRUE, 0 );
}
return TRUE;
}