[SHELL32] Fix Assertion when opening "File" menu in MyComputer twice (#4675)

ReactOS explorer shell asserts when opening the "File" menu in MyComputer for the second time.
This is due to the cached copy of IContextMenu not being released before attempting to cache it again.

Fix based on the patch proposed by JIRA user I_Kill_Bugs

CORE-18353

Signed-off by: I_Kill_Bugs (original patch author)
This commit is contained in:
Kyle Katarn 2022-09-10 15:59:00 +02:00 committed by GitHub
parent 6dcc07c18d
commit 86addae3cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1310,6 +1310,13 @@ HRESULT CDefView::FillFileMenu()
if (!hFileMenu)
return E_FAIL;
/* Release cached IContextMenu */
if (m_pCM)
{
IUnknown_SetSite(m_pCM, NULL);
m_pCM.Release();
}
/* Cleanup the items added previously */
for (int i = GetMenuItemCount(hFileMenu) - 1; i >= 0; i--)
{