Skip to content

Commit ef34c3d

Browse files
committed
Merge pull request #112663 from nikitalita/script-editor-fix
ScriptEditor::reload_scripts: only call deferred if not main thread
2 parents d5c0a11 + 94104ae commit ef34c3d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

editor/script/script_editor_plugin.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2821,7 +2821,11 @@ void ScriptEditor::apply_scripts() const {
28212821

28222822
void ScriptEditor::reload_scripts(bool p_refresh_only) {
28232823
// Call deferred to make sure it runs on the main thread.
2824-
callable_mp(this, &ScriptEditor::_reload_scripts).call_deferred(p_refresh_only);
2824+
if (!Thread::is_main_thread()) {
2825+
callable_mp(this, &ScriptEditor::_reload_scripts).call_deferred(p_refresh_only);
2826+
return;
2827+
}
2828+
_reload_scripts(p_refresh_only);
28252829
}
28262830

28272831
void ScriptEditor::_reload_scripts(bool p_refresh_only) {

0 commit comments

Comments
 (0)