From 322cd52c167842f22d818066ef18ce7b25439075 Mon Sep 17 00:00:00 2001 From: quarrel07 <178681861+quarrel07@users.noreply.github.com> Date: Thu, 23 Jul 2026 11:23:53 -0700 Subject: Exit cleanly after teardown instead of racing static destructors (#718) Normal quits ran the full static-destructor chain, where destruction order is unspecified and something logs through spdlog after its statics are destroyed, intermittently segfaulting on exit (same class as upstream issue #689). All user-visible state (config, saves) is already persisted by GameEngine::Destroy, so end the process with _Exit like the extraction error paths already do. Co-authored-by: Claude Fable 5 Co-authored-by: MegaMech --- src/port/Game.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/port/Game.cpp b/src/port/Game.cpp index 1c6d49af9..9804fe324 100644 --- a/src/port/Game.cpp +++ b/src/port/Game.cpp @@ -1070,5 +1070,9 @@ extern "C" CustomEngineDestroy(); // GameEngine::Instance->ProcessFrame(push_frame); GameEngine::Instance->Destroy(); - return 0; + // Everything user-visible (config, saves) is persisted by Destroy(). Skip the + // remaining static destructors: their order is unspecified and some log after + // spdlog's own statics are gone, crashing on quit (same class as issue #689). + // Mirrors the _Exit precedent on the extraction error paths. + _Exit(0); } -- cgit v1.2.3