Commit a9ac425a authored by Fabian Maurer's avatar Fabian Maurer Committed by Alexandre Julliard

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: 's avatarFabian Maurer <dark.shadow4@web.de> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent b6cb27ea
...@@ -3859,17 +3859,23 @@ BOOL WINAPI HiliteMenuItem( HWND hWnd, HMENU hMenu, UINT wItemID, ...@@ -3859,17 +3859,23 @@ BOOL WINAPI HiliteMenuItem( HWND hWnd, HMENU hMenu, UINT wItemID,
{ {
POPUPMENU *menu; POPUPMENU *menu;
UINT pos; UINT pos;
HMENU handle_menu;
UINT focused_item;
TRACE("(%p, %p, %04x, %04x);\n", hWnd, hMenu, wItemID, wHilite); TRACE("(%p, %p, %04x, %04x);\n", hWnd, hMenu, wItemID, wHilite);
if (!(menu = find_menu_item(hMenu, wItemID, wHilite, &pos))) return FALSE; if (!(menu = find_menu_item(hMenu, wItemID, wHilite, &pos))) return FALSE;
if (menu->FocusedItem != pos) handle_menu = menu->obj.handle;
focused_item = menu->FocusedItem;
release_menu_ptr(menu);
if (focused_item != pos)
{ {
MENU_HideSubPopups( hWnd, menu->obj.handle, FALSE, 0 ); MENU_HideSubPopups( hWnd, handle_menu, FALSE, 0 );
MENU_SelectItem( hWnd, menu->obj.handle, pos, TRUE, 0 ); MENU_SelectItem( hWnd, handle_menu, pos, TRUE, 0 );
} }
release_menu_ptr(menu);
return TRUE; return TRUE;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment