The menu must be release on all code-paths, else the underlying lock will never be released.
Fixes bug 45355.
Signed-off-by: Fabian Maurer dark.shadow4@web.de --- dlls/user32/menu.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/dlls/user32/menu.c b/dlls/user32/menu.c index 8c541cc4f91..570c6992cc9 100644 --- a/dlls/user32/menu.c +++ b/dlls/user32/menu.c @@ -3751,9 +3751,11 @@ BOOL WINAPI EnableMenuItem( HMENU hMenu, UINT id, UINT wFlags )
/* Get the parent menu to access*/ parentMenu = grab_menu_ptr(menu->hSysMenuOwner); - release_menu_ptr(menu); if (!parentMenu) + { + release_menu_ptr(menu); return (UINT)-1; + }
hwnd = parentMenu->hWnd; release_menu_ptr(parentMenu); @@ -3764,8 +3766,7 @@ BOOL WINAPI EnableMenuItem( HMENU hMenu, UINT id, UINT wFlags ) RedrawWindow(hwnd, &rc, 0, RDW_FRAME | RDW_INVALIDATE | RDW_NOCHILDREN); } } - else - release_menu_ptr(menu); + release_menu_ptr(menu);
return oldflags; }
Fabian Maurer dark.shadow4@web.de writes:
@@ -3751,9 +3751,11 @@ BOOL WINAPI EnableMenuItem( HMENU hMenu, UINT id, UINT wFlags )
/* Get the parent menu to access*/ parentMenu = grab_menu_ptr(menu->hSysMenuOwner);
release_menu_ptr(menu); if (!parentMenu)
{
release_menu_ptr(menu); return (UINT)-1;
} hwnd = parentMenu->hWnd; release_menu_ptr(parentMenu);
@@ -3764,8 +3766,7 @@ BOOL WINAPI EnableMenuItem( HMENU hMenu, UINT id, UINT wFlags ) RedrawWindow(hwnd, &rc, 0, RDW_FRAME | RDW_INVALIDATE | RDW_NOCHILDREN); } }
- else
release_menu_ptr(menu);
- release_menu_ptr(menu);
You can't call RedrawWindow() while holding the lock.