1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-29 23:07:48 +02:00

Workaround for crash due to static destruction order

This commit is contained in:
Ivan Savenko
2025-03-26 20:32:55 +00:00
parent 7d3e59d7d3
commit 8771ecdf57
2 changed files with 19 additions and 1 deletions

View File

@@ -48,6 +48,7 @@ class DLL_LINKAGE SettingsStorage
public:
// Initialize config structure
SettingsStorage();
~SettingsStorage();
void init(const std::string & dataFilename, const std::string & schema);
// Get write access to config node at path
@@ -73,11 +74,15 @@ class DLL_LINKAGE SettingsListener
// Callback
std::function<void(const JsonNode&)> callback;
// hack for crash due to static destruction order
bool wasTerminated = false;
SettingsListener(SettingsStorage & _parent, std::vector<std::string> _path);
// Executes callback if changedpath begins with path
void nodeInvalidated(const std::vector<std::string> & changedPath);
void terminate();
public:
SettingsListener(const SettingsListener &sl);
~SettingsListener();