https://git.reactos.org/?p=reactos.git;a=commitdiff;h=86addae3cc6653d2e04e0d...
commit 86addae3cc6653d2e04e0d62ab4eb82db8b40ad9 Author: Kyle Katarn contact@kcsoftwares.com AuthorDate: Sat Sep 10 15:59:00 2022 +0200 Commit: GitHub noreply@github.com CommitDate: Sat Sep 10 15:59:00 2022 +0200
[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) --- dll/win32/shell32/CDefView.cpp | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/dll/win32/shell32/CDefView.cpp b/dll/win32/shell32/CDefView.cpp index a152ac6c263..98b597c59d4 100644 --- a/dll/win32/shell32/CDefView.cpp +++ b/dll/win32/shell32/CDefView.cpp @@ -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--) {