From 8f47edc1e3acfde5c41d9147f26364c5853191d4 Mon Sep 17 00:00:00 2001 From: Nicolas Hake Date: Sun, 16 Oct 2016 18:40:51 +0200 Subject: [PATCH] Fix destruction order of system string table vs. editor Depending on the mood of the linker, the editor may have been constructed before and destroyed after the system-wide string table because they weren't defined in the same file. Destruction of the editor tries to load some strings, which would then access the already destroyed string table and thus crash. --- src/C4Globals.cpp | 2 ++ src/c4group/C4LangStringTable.cpp | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/C4Globals.cpp b/src/C4Globals.cpp index 4fe722d90..949197012 100644 --- a/src/C4Globals.cpp +++ b/src/C4Globals.cpp @@ -25,6 +25,7 @@ #include "game/C4GraphicsSystem.h" #include "game/C4Game.h" #include "object/C4GameObjects.h" +#include "c4group/C4LangStringTable.h" #include "gui/C4MouseControl.h" #include "network/C4Network2.h" #include "script/C4PropList.h" @@ -37,6 +38,7 @@ C4Set C4PropListNumbered::PropLists; C4Set C4PropListScript::PropLists; std::vector C4PropListNumbered::ShelvedPropLists; int32_t C4PropListNumbered::EnumerationIndex = 0; +C4LangStringTable C4LangStringTable::system_string_table; C4StringTable Strings; C4AulScriptEngine ScriptEngine; C4Application Application; diff --git a/src/c4group/C4LangStringTable.cpp b/src/c4group/C4LangStringTable.cpp index d6c227da4..076edf003 100644 --- a/src/c4group/C4LangStringTable.cpp +++ b/src/c4group/C4LangStringTable.cpp @@ -174,5 +174,3 @@ void C4LangStringTable::ReplaceStrings(StdStrBuf &rBuf) { ReplaceStrings(rBuf, rBuf); } - -C4LangStringTable C4LangStringTable::system_string_table;