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

user32: Always release menu item in EnableMenuItem.

parent 15215bd0
...@@ -3741,28 +3741,25 @@ BOOL WINAPI EnableMenuItem( HMENU hMenu, UINT id, UINT wFlags ) ...@@ -3741,28 +3741,25 @@ BOOL WINAPI EnableMenuItem( HMENU hMenu, UINT id, UINT wFlags )
item->fState ^= (oldflags ^ wFlags) & (MF_GRAYED | MF_DISABLED); item->fState ^= (oldflags ^ wFlags) & (MF_GRAYED | MF_DISABLED);
/* If the close item in the system menu change update the close button */ /* If the close item in the system menu change update the close button */
if ((item->wID == SC_CLOSE) && (oldflags != wFlags)) if ((item->wID == SC_CLOSE) && (oldflags != wFlags) && menu->hSysMenuOwner)
{ {
if (menu->hSysMenuOwner) RECT rc;
{ POPUPMENU* parentMenu;
RECT rc; HWND hwnd;
POPUPMENU* parentMenu;
HWND hwnd;
/* Get the parent menu to access*/ /* Get the parent menu to access */
parentMenu = grab_menu_ptr(menu->hSysMenuOwner); parentMenu = grab_menu_ptr(menu->hSysMenuOwner);
release_menu_ptr(menu); release_menu_ptr(menu);
if (!parentMenu) if (!parentMenu)
return (UINT)-1; return (UINT)-1;
hwnd = parentMenu->hWnd; hwnd = parentMenu->hWnd;
release_menu_ptr(parentMenu); release_menu_ptr(parentMenu);
/* Refresh the frame to reflect the change */ /* Refresh the frame to reflect the change */
WIN_GetRectangles( hwnd, COORDS_CLIENT, &rc, NULL ); WIN_GetRectangles(hwnd, COORDS_CLIENT, &rc, NULL);
rc.bottom = 0; rc.bottom = 0;
RedrawWindow(hwnd, &rc, 0, RDW_FRAME | RDW_INVALIDATE | RDW_NOCHILDREN); RedrawWindow(hwnd, &rc, 0, RDW_FRAME | RDW_INVALIDATE | RDW_NOCHILDREN);
}
} }
else else
release_menu_ptr(menu); release_menu_ptr(menu);
......
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