diff options
author | Thaddeus Crews <repiteo@outlook.com> | 2024-11-22 14:54:26 -0600 |
---|---|---|
committer | Thaddeus Crews <repiteo@outlook.com> | 2024-11-22 14:54:26 -0600 |
commit | e7b11d1c995beebe69c3102da45921644afd687b (patch) | |
tree | 955c0d74a148376791586d38a5c1843d3741865a | |
parent | fca3a224c4d3853b63b022381172181a5caeeb13 (diff) | |
parent | 7a25173ff469b3b593cb8a5a311617c5cde9b80a (diff) | |
download | redot-engine-e7b11d1c995beebe69c3102da45921644afd687b.tar.gz |
Merge pull request #99527 from RandomShaper/fix_threaded_trans
Make loading translations from threads safe
-rw-r--r-- | core/string/translation.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/core/string/translation.cpp b/core/string/translation.cpp index 020949371f..d944135a70 100644 --- a/core/string/translation.cpp +++ b/core/string/translation.cpp @@ -80,8 +80,10 @@ void Translation::set_locale(const String &p_locale) { if (Thread::is_main_thread()) { _notify_translation_changed_if_applies(); } else { - // Avoid calling non-thread-safe functions here. - callable_mp(this, &Translation::_notify_translation_changed_if_applies).call_deferred(); + // This has to happen on the main thread (bypassing the ResourceLoader per-thread call queue) + // because it interacts with the generally non-thread-safe window management, leading to + // different issues across platforms otherwise. + MessageQueue::get_main_singleton()->push_callable(callable_mp(this, &Translation::_notify_translation_changed_if_applies)); } } |