mirror of https://github.com/godotengine/godot
Make loading translations from threads safe
This commit is contained in:
parent
9e6098432a
commit
7a25173ff4
|
|
@ -80,8 +80,10 @@ void Translation::set_locale(const String &p_locale) {
|
||||||
if (Thread::is_main_thread()) {
|
if (Thread::is_main_thread()) {
|
||||||
_notify_translation_changed_if_applies();
|
_notify_translation_changed_if_applies();
|
||||||
} else {
|
} else {
|
||||||
// Avoid calling non-thread-safe functions here.
|
// This has to happen on the main thread (bypassing the ResourceLoader per-thread call queue)
|
||||||
callable_mp(this, &Translation::_notify_translation_changed_if_applies).call_deferred();
|
// 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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue