Fabian Maurer : user32: Always release menu item in EnableMenuItem.
Alexandre Julliard
julliard at winehq.org
Mon Jun 25 15:41:51 CDT 2018
Module: wine
Branch: master
Commit: aee9fa0e55f9282c7fd6961ac0b32e1f2d33c76c
URL: https://source.winehq.org/git/wine.git/?a=commit;h=aee9fa0e55f9282c7fd6961ac0b32e1f2d33c76c
Author: Fabian Maurer <dark.shadow4 at web.de>
Date: Fri Jun 22 20:32:17 2018 +0200
user32: Always release menu item in EnableMenuItem.
Signed-off-by: Fabian Maurer <dark.shadow4 at web.de>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/user32/menu.c | 33 +++++++++++++++------------------
1 file changed, 15 insertions(+), 18 deletions(-)
diff --git a/dlls/user32/menu.c b/dlls/user32/menu.c
index 8c541cc..ab1ae9b 100644
--- a/dlls/user32/menu.c
+++ b/dlls/user32/menu.c
@@ -3741,28 +3741,25 @@ BOOL WINAPI EnableMenuItem( HMENU hMenu, UINT id, UINT wFlags )
item->fState ^= (oldflags ^ wFlags) & (MF_GRAYED | MF_DISABLED);
/* 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;
- HWND hwnd;
+ RECT rc;
+ POPUPMENU* parentMenu;
+ HWND hwnd;
- /* Get the parent menu to access*/
- parentMenu = grab_menu_ptr(menu->hSysMenuOwner);
- release_menu_ptr(menu);
- if (!parentMenu)
- return (UINT)-1;
+ /* Get the parent menu to access */
+ parentMenu = grab_menu_ptr(menu->hSysMenuOwner);
+ release_menu_ptr(menu);
+ if (!parentMenu)
+ return (UINT)-1;
- hwnd = parentMenu->hWnd;
- release_menu_ptr(parentMenu);
+ hwnd = parentMenu->hWnd;
+ release_menu_ptr(parentMenu);
- /* Refresh the frame to reflect the change */
- WIN_GetRectangles( hwnd, COORDS_CLIENT, &rc, NULL );
- rc.bottom = 0;
- RedrawWindow(hwnd, &rc, 0, RDW_FRAME | RDW_INVALIDATE | RDW_NOCHILDREN);
- }
+ /* Refresh the frame to reflect the change */
+ WIN_GetRectangles(hwnd, COORDS_CLIENT, &rc, NULL);
+ rc.bottom = 0;
+ RedrawWindow(hwnd, &rc, 0, RDW_FRAME | RDW_INVALIDATE | RDW_NOCHILDREN);
}
else
release_menu_ptr(menu);
More information about the wine-cvs
mailing list