Skip to content

Fix Explorer crash when Open-Shell exits while the menu is open - #2576

Merged
ge0rdi merged 1 commit into
Open-Shell:masterfrom
emilioheredia-source:fix-exit-crash
Nov 7, 2026
Merged

ge0rdi merged 1 commit into
Open-Shell:masterfrom
emilioheredia-source:fix-exit-crash

Conversation

@emilioheredia-source

Copy link
Copy Markdown

CleanStartMenuDLL called CloseManagers() before CMenuContainer::CloseStartMenu().
If the start menu was open at exit, destroying it ran CMenuContainer::OnDestroy →
g_SearchManager.CloseMenu(), which locks the search manager's critical section. That
lock had already been deleted, so Explorer crashed.

StartMenuDLL!CSearchManager::CloseMenu+0x2d  (SearchManager.cpp:139)
StartMenuDLL!CMenuContainer::OnDestroy+0x361
...
StartMenuDLL!CMenuContainer::CloseStartMenu+0xa0
StartMenuDLL!CleanStartMenuDLL+0x605
StartMenuDLL!HookDesktopThread+0x7e6
FAILURE_BUCKET_ID: NULL_CLASS_PTR_WRITE_AVRF_c0000005_StartMenuDLL.dll!CSearchManager::CloseMenu

The fix closes the menu, the settings window and the owner window before the managers are
shut down. The order has been like this since at least the Classic Shell → Open-Shell
rebrand, so 4.4.198 is affected too.

To reproduce: start StartMenu.exe, run StartMenu.exe -open, and while the menu is
visible run StartMenu.exe -exit. Explorer restarts.

Tested on Windows 11 26100: unmodified master crashed Explorer in every run with the
menu open at exit. With this change, 5 of 5 such runs exited cleanly.

That test ran on master 1384d4e. The branch has since been rebased onto current master (9dfa7fa) with the same change, and I've been running it in my daily build since then.

CleanStartMenuDLL called CloseManagers() before CMenuContainer::CloseStartMenu().
When the start menu was still open at exit, destroying it ran
CMenuContainer::OnDestroy -> g_SearchManager.CloseMenu(), which locks the
search manager's critical section. CloseManagers had already deleted that
lock, so Explorer crashed with an access violation in
ntdll!RtlpWaitOnCriticalSection. This order dates back to at least the
Classic Shell -> Open-Shell rebrand and is in 4.4.198 and current master.

The menu, the settings window and the owner window are now closed before
the managers are shut down.

Found with a crash dump (WER LocalDumps + full page heap on explorer.exe):
  StartMenuDLL!CSearchManager::CloseMenu+0x2d  (SearchManager.cpp:139)
  StartMenuDLL!CMenuContainer::OnDestroy+0x361
  ...
  StartMenuDLL!CMenuContainer::CloseStartMenu+0xa0
  StartMenuDLL!CleanStartMenuDLL+0x605
  StartMenuDLL!HookDesktopThread+0x7e6
  FAILURE_BUCKET_ID: NULL_CLASS_PTR_WRITE_AVRF_c0000005_StartMenuDLL.dll!CSearchManager::CloseMenu

Reproduce: start StartMenu.exe, run "StartMenu.exe -open", and while the
menu is visible run "StartMenu.exe -exit". Explorer restarts.
Verified on Windows 11 (26100): unmodified master crashed Explorer in every
run with the menu open at exit; with this change, 5 of 5 such runs exited
cleanly.
@ge0rdi
ge0rdi merged commit 844da62 into Open-Shell:master Nov 7, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants