Skip to content

Commit

Permalink
[NTUSER] MENU_HideSubPopups: Check ValidateHwndNoErr return value
Browse files Browse the repository at this point in the history
Check if the return value is not NULL before calling co_UserDestroyWindow.
CORE-19367
  • Loading branch information
TAN-Gaming committed Dec 9, 2023
1 parent e4d03f4 commit 80f4349
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions win32ss/user/ntuser/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -3282,11 +3282,9 @@ static void FASTCALL MENU_HideSubPopups(PWND pWndOwner, PMENU Menu,
{
PWND pWnd;
if (!VerifyMenu(Item->spSubMenu)) return;
pWnd = ValidateHwndNoErr(Item->spSubMenu->hWnd);
MENU_HideSubPopups(pWndOwner, Item->spSubMenu, FALSE, wFlags);
MENU_SelectItem(pWndOwner, Item->spSubMenu, NO_SELECTED_ITEM, SendMenuSelect, NULL);
TRACE("M_HSP top p hm %p pWndOwner IDMenu %p\n",top_popup_hmenu,pWndOwner->IDMenu);
co_UserDestroyWindow(pWnd);

/* Native returns handle to destroyed window */
if (!(wFlags & TPM_NONOTIFY))
Expand All @@ -3298,6 +3296,10 @@ static void FASTCALL MENU_HideSubPopups(PWND pWndOwner, PMENU Menu,
// Call WM_UNINITMENUPOPUP FIRST before destroy!!
// Fixes todo_wine User32 test menu.c line 2239 GetMenuBarInfo callback....
//
pWnd = ValidateHwndNoErr(Item->spSubMenu->hWnd);
if (pWnd)
co_UserDestroyWindow(pWnd);

Item->spSubMenu->hWnd = NULL;
////
}
Expand Down

0 comments on commit 80f4349

Please sign in to comment.