From 94104ae33af1232e6c3f3cdd8d3731dff807bdd6 Mon Sep 17 00:00:00 2001 From: nikitalita <69168929+nikitalita@users.noreply.github.com> Date: Wed, 12 Nov 2025 10:14:33 +0100 Subject: [PATCH] ScriptEditor::reload_scripts only call deferred if not main thread --- editor/script/script_editor_plugin.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/editor/script/script_editor_plugin.cpp b/editor/script/script_editor_plugin.cpp index 5bfce094a9c..bc52db2bff7 100644 --- a/editor/script/script_editor_plugin.cpp +++ b/editor/script/script_editor_plugin.cpp @@ -2821,7 +2821,11 @@ void ScriptEditor::apply_scripts() const { void ScriptEditor::reload_scripts(bool p_refresh_only) { // Call deferred to make sure it runs on the main thread. - callable_mp(this, &ScriptEditor::_reload_scripts).call_deferred(p_refresh_only); + if (!Thread::is_main_thread()) { + callable_mp(this, &ScriptEditor::_reload_scripts).call_deferred(p_refresh_only); + return; + } + _reload_scripts(p_refresh_only); } void ScriptEditor::_reload_scripts(bool p_refresh_only) {