Skip to content

Commit 38c3e5a

Browse files
committed
Merge pull request #82956 from Chtau/GDScript-external-Editor-Engine-crash
Fixes internal Script Editor crash with External Editor active
2 parents 9df6491 + 2929993 commit 38c3e5a

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

editor/plugins/script_editor_plugin.cpp

+8-3
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ String ScriptEditor::_get_debug_tooltip(const String &p_text, Node *_se) {
445445
}
446446

447447
void ScriptEditor::_breaked(bool p_breaked, bool p_can_debug) {
448-
if (bool(EDITOR_GET("text_editor/external/use_external_editor"))) {
448+
if (external_editor_active) {
449449
return;
450450
}
451451

@@ -2278,7 +2278,7 @@ bool ScriptEditor::edit(const Ref<Resource> &p_resource, int p_line, int p_col,
22782278

22792279
// Don't open dominant script if using an external editor.
22802280
bool use_external_editor =
2281-
EDITOR_GET("text_editor/external/use_external_editor") ||
2281+
external_editor_active ||
22822282
(scr.is_valid() && scr->get_language()->overrides_external_editor());
22832283
use_external_editor = use_external_editor && !(scr.is_valid() && scr->is_built_in()); // Ignore external editor for built-in scripts.
22842284
const bool open_dominant = EDITOR_GET("text_editor/behavior/files/open_dominant_script_on_scene_change");
@@ -2608,6 +2608,9 @@ void ScriptEditor::apply_scripts() const {
26082608
}
26092609

26102610
void ScriptEditor::reload_scripts(bool p_refresh_only) {
2611+
if (external_editor_active) {
2612+
return;
2613+
}
26112614
for (int i = 0; i < tab_container->get_tab_count(); i++) {
26122615
ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_tab_control(i));
26132616
if (!se) {
@@ -2775,6 +2778,7 @@ void ScriptEditor::_editor_settings_changed() {
27752778

27762779
members_overview_enabled = EDITOR_GET("text_editor/script_list/show_members_overview");
27772780
help_overview_enabled = EDITOR_GET("text_editor/help/show_help_index");
2781+
external_editor_active = EDITOR_GET("text_editor/external/use_external_editor");
27782782
_update_members_overview_visibility();
27792783
_update_help_overview_visibility();
27802784

@@ -3571,7 +3575,7 @@ TypedArray<ScriptEditorBase> ScriptEditor::_get_open_script_editors() const {
35713575
void ScriptEditor::set_scene_root_script(Ref<Script> p_script) {
35723576
// Don't open dominant script if using an external editor.
35733577
bool use_external_editor =
3574-
EDITOR_GET("text_editor/external/use_external_editor") ||
3578+
external_editor_active ||
35753579
(p_script.is_valid() && p_script->get_language()->overrides_external_editor());
35763580
use_external_editor = use_external_editor && !(p_script.is_valid() && p_script->is_built_in()); // Ignore external editor for built-in scripts.
35773581
const bool open_dominant = EDITOR_GET("text_editor/behavior/files/open_dominant_script_on_scene_change");
@@ -3839,6 +3843,7 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) {
38393843
waiting_update_names = false;
38403844
pending_auto_reload = false;
38413845
auto_reload_running_scripts = true;
3846+
external_editor_active = false;
38423847
members_overview_enabled = EDITOR_GET("text_editor/script_list/show_members_overview");
38433848
help_overview_enabled = EDITOR_GET("text_editor/help/show_help_index");
38443849

editor/plugins/script_editor_plugin.h

+1
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,7 @@ class ScriptEditor : public PanelContainer {
395395
bool open_textfile_after_create = true;
396396
bool trim_trailing_whitespace_on_save;
397397
bool convert_indent_on_save;
398+
bool external_editor_active;
398399

399400
void _goto_script_line2(int p_line);
400401
void _goto_script_line(Ref<RefCounted> p_script, int p_line);

0 commit comments

Comments
 (0)