From eb414422fe6dc3f85d49d7a94d6fc34ae645f10f Mon Sep 17 00:00:00 2001 From: Saracen Date: Sun, 24 Sep 2023 13:43:10 +0100 Subject: [PATCH] Make notify_dependency_error only defer calls if called from secondary threads. (cherry picked from commit 0b0a6109b6d8974899691fd1dd883eca994b769f) --- core/io/resource_loader.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/io/resource_loader.h b/core/io/resource_loader.h index 2701caa3f47..68234728eec 100644 --- a/core/io/resource_loader.h +++ b/core/io/resource_loader.h @@ -231,7 +231,11 @@ public: // Loaders can safely use this regardless which thread they are running on. static void notify_dependency_error(const String &p_path, const String &p_dependency, const String &p_type) { if (dep_err_notify) { - callable_mp_static(dep_err_notify).bind(p_path, p_dependency, p_type).call_deferred(); + if (Thread::get_caller_id() == Thread::get_main_id()) { + dep_err_notify(p_path, p_dependency, p_type); + } else { + callable_mp_static(dep_err_notify).bind(p_path, p_dependency, p_type).call_deferred(); + } } } static void set_dependency_error_notify_func(DependencyErrorNotify p_err_notify) {