[PATCH v2] user32: Always release menu item in EnableMenuItem

Alexandre Julliard julliard at winehq.org
Fri Jun 22 05:48:42 CDT 2018


Fabian Maurer <dark.shadow4 at 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.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list