Browse Source

Merge pull request #112663 from nikitalita/script-editor-fix

ScriptEditor::reload_scripts: only call deferred if not main thread
Thaddeus Crews 1 month ago
parent
commit
ef34c3d534
1 changed files with 5 additions and 1 deletions
  1. 5 1
      editor/script/script_editor_plugin.cpp

+ 5 - 1
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) {