Skip to content

fix(crash): replace exit(1) in ShutdownHandler with SDL_QUIT event#1114

Open
bassdr wants to merge 2 commits into
Kenix3:mainfrom
bassdr:fix/sigint-shutdown
Open

fix(crash): replace exit(1) in ShutdownHandler with SDL_QUIT event#1114
bassdr wants to merge 2 commits into
Kenix3:mainfrom
bassdr:fix/sigint-shutdown

Conversation

@bassdr

@bassdr bassdr commented May 30, 2026

Copy link
Copy Markdown

Calling exit() from a signal handler is not async-signal-safe: it triggers C++ destructors and atexit handlers which try to acquire mutexes already held by audio threads, causing a deadlock that the OS aborts as a crash. Push SDL_QUIT instead so the main event loop shuts down cleanly via the existing Close() path.

@serprex serprex mentioned this pull request Jun 6, 2026
bassdr and others added 2 commits June 8, 2026 16:06
Calling exit() from a signal handler is not async-signal-safe: it
triggers C++ destructors and atexit handlers which try to acquire
mutexes already held by audio threads, causing a deadlock that the
OS aborts as a crash. Push SDL_QUIT instead so the main event loop
shuts down cleanly via the existing Close() path.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The crash is caused by acquiring content of the shared_ptr after it was released.
Added two shared_ptrs, one for ImGuiWMInit/Shudtown and the other for ImGuiBackendInit/Shutdown.
this way we are sure it's not used anymore by anyone.
@bassdr bassdr force-pushed the fix/sigint-shutdown branch from d6da9fa to 1a309ed Compare June 8, 2026 20:06
@bassdr

bassdr commented Jun 8, 2026

Copy link
Copy Markdown
Author

I just rebased on latest main to see if the CICD failures on MAC/IOS was caused by this. I can't explain how this could break them.

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