SDLApplication: fix crash in SDL_Quit on Windows by calling SDL_QuitSubSystem first with the same flags passed to SDL_Init (closes #1934)

As far as I can tell, SDL_QuitSubSystem is not required, and SDL_Quit should automatically quit each subsystem. However, this stops the crash, so maybe there's some kind of race condition that this avoids.
This commit is contained in:
Josh Tynjala
2025-10-03 14:54:19 -07:00
parent 48969a3d81
commit 9bea6169bf
2 changed files with 4 additions and 1 deletions

View File

@@ -25,7 +25,7 @@ namespace lime {
SDLApplication::SDLApplication () {
Uint32 initFlags = SDL_INIT_VIDEO | SDL_INIT_GAMECONTROLLER | SDL_INIT_TIMER | SDL_INIT_JOYSTICK;
initFlags = SDL_INIT_VIDEO | SDL_INIT_GAMECONTROLLER | SDL_INIT_TIMER | SDL_INIT_JOYSTICK;
#if defined(LIME_MOJOAL) || defined(LIME_OPENALSOFT)
initFlags |= SDL_INIT_AUDIO;
#endif
@@ -814,6 +814,8 @@ namespace lime {
applicationEvent.type = EXIT;
ApplicationEvent::Dispatch (&applicationEvent);
SDL_QuitSubSystem (initFlags);
SDL_Quit ();
return 0;

View File

@@ -63,6 +63,7 @@ namespace lime {
ClipboardEvent clipboardEvent;
Uint32 currentUpdate;
double framePeriod;
Uint32 initFlags;
DropEvent dropEvent;
GamepadEvent gamepadEvent;
JoystickEvent joystickEvent;