Skip to content

Commit 7531054

Browse files
kisgkonczg
authored andcommitted
Make TranslationServer singleton variable inline.
This change avoids the problem known as 'Static Initialization Order Fiasco' (SIOF). See the following PR for more explanation: godotengine#94683 Co-authored-by: Gabor Koncz <gabor.koncz@migeran.com>
1 parent dd6a391 commit 7531054

File tree

2 files changed

+1
-3
lines changed

2 files changed

+1
-3
lines changed

core/string/translation_server.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -388,8 +388,6 @@ StringName TranslationServer::translate_plural(const StringName &p_message, cons
388388
return main_domain->translate_plural(p_message, p_message_plural, p_n, p_context);
389389
}
390390

391-
TranslationServer *TranslationServer::singleton = nullptr;
392-
393391
bool TranslationServer::_load_translations(const String &p_from) {
394392
if (ProjectSettings::get_singleton()->has_setting(p_from)) {
395393
const Vector<String> &translation_names = GLOBAL_GET(p_from);

core/string/translation_server.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class TranslationServer : public Object {
4848

4949
bool enabled = true;
5050

51-
static TranslationServer *singleton;
51+
static inline TranslationServer *singleton = nullptr;
5252
bool _load_translations(const String &p_from);
5353
String _standardize_locale(const String &p_locale, bool p_add_defaults) const;
5454

0 commit comments

Comments
 (0)