[PATCH] user32: Always release menu item in EnableMenuItem
Nikolay Sivov
bunglehead at gmail.com
Wed Jun 20 16:12:06 CDT 2018
On 6/20/2018 11:46 PM, Fabian Maurer wrote:
> 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 at web.de>
> ---
> dlls/user32/menu.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/dlls/user32/menu.c b/dlls/user32/menu.c
> index 8c541cc4f91..0b1133bbc41 100644
> --- a/dlls/user32/menu.c
> +++ b/dlls/user32/menu.c
> @@ -590,6 +590,7 @@ static POPUPMENU *find_menu_item(HMENU hmenu, UINT id, UINT flags, UINT *pos)
> POPUPMENU *menu;
>
> menu = grab_menu_ptr(hmenu);
> +
> if (!menu)
> return NULL;
>
> @@ -3763,6 +3764,8 @@ BOOL WINAPI EnableMenuItem( HMENU hMenu, UINT id, UINT wFlags )
> rc.bottom = 0;
> RedrawWindow(hwnd, &rc, 0, RDW_FRAME | RDW_INVALIDATE | RDW_NOCHILDREN);
> }
> + else
> + release_menu_ptr(menu);
> }
> else
> release_menu_ptr(menu);
>
It looks like it's enough to merge conditions to avoid such repetition.
More information about the wine-devel
mailing list