Skip to content

Commit e7b11d1

Browse files
committed
Merge pull request #99527 from RandomShaper/fix_threaded_trans
Make loading translations from threads safe
2 parents fca3a22 + 7a25173 commit e7b11d1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

core/string/translation.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,10 @@ void Translation::set_locale(const String &p_locale) {
8080
if (Thread::is_main_thread()) {
8181
_notify_translation_changed_if_applies();
8282
} else {
83-
// Avoid calling non-thread-safe functions here.
84-
callable_mp(this, &Translation::_notify_translation_changed_if_applies).call_deferred();
83+
// This has to happen on the main thread (bypassing the ResourceLoader per-thread call queue)
84+
// because it interacts with the generally non-thread-safe window management, leading to
85+
// different issues across platforms otherwise.
86+
MessageQueue::get_main_singleton()->push_callable(callable_mp(this, &Translation::_notify_translation_changed_if_applies));
8587
}
8688
}
8789

0 commit comments

Comments
 (0)