Repository navigation
fix: don't call SDL_Quit from the SDL2 video driver - #1997
Merged
Flow86 merged 1 commit intoOct 24, 2026
Merged
Conversation
VideoSDL2::CleanUp shut down all of SDL, while the SDL audio driver still had its subsystem initialized. The audio driver is only cleaned up later during static destruction, so it called Mix_CloseAudio, Mix_Quit and SDL_QuitSubSystem on an already terminated SDL. Classic SDL2 tolerated this, but sdl2-compat on top of SDL3 (what Homebrew ships as sdl2 now) crashes in AudioSDL::~AudioSDL on exit. Each driver now only quits the subsystem it initialized. SDL refcounts subsystems and shuts itself down with the last one.
Flow86
approved these changes
Oct 24, 2026
Contributor
Author
|
This is the fastest I have ever gotten a feedback on a PR 👍 Thanks |
Member
|
Are we missing anything with this now? I.e. any (sub)system that won't be closed now? |
Member
|
SDL_quit is not essential, so it's fine |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi,
I was looking into ways to play Siedler 2 on my Mac and came across this project. Thanks for the effort, greatly appreciated! It builds natively on Apple Silicon and works nicely, but it crashed when I closed the window.
Short debug session: VideoSDL2::CleanUp calls SDL_Quit(), which shuts down all of SDL, including the audio subsystem the SDL audio driver still holds. That driver is only cleaned up later, during static destruction at exit, so AudioSDL::~AudioSDL calls Mix_CloseAudio/SDL_QuitSubSystem on an already terminated SDL. Classic SDL2 tolerated that, but sdl2-compat on SDL3 (what Homebrew ships as sdl2 now) crashes.
Removing the call fixes it. Each driver quits only the subsystem it initialized, and SDL shuts down with the last one.
Stack (macOS crash report)
libc++abi std::terminate()
libaudioSDL.dylib AudioSDL::~AudioSDL()
s25client AudioDriverWrapper::~AudioDriverWrapper()
s25client Singleton<AudioDriverWrapper, ...>::DestroySingleton()
libsystem_c exit