Browse Source

Fix incorrectly clearing edit menu

Delete only if `editor_enabled` is true, otherwise destructor may delete it repeatedly.
Rindbee 3 years ago
parent
commit
8972dd8492
1 changed files with 3 additions and 1 deletions
  1. 3 1
      editor/plugins/script_text_editor.cpp

+ 3 - 1
editor/plugins/script_text_editor.cpp

@@ -1420,7 +1420,9 @@ Control *ScriptTextEditor::get_edit_menu() {
 }
 }
 
 
 void ScriptTextEditor::clear_edit_menu() {
 void ScriptTextEditor::clear_edit_menu() {
-	memdelete(edit_hb);
+	if (editor_enabled) {
+		memdelete(edit_hb);
+	}
 }
 }
 
 
 void ScriptTextEditor::set_find_replace_bar(FindReplaceBar *p_bar) {
 void ScriptTextEditor::set_find_replace_bar(FindReplaceBar *p_bar) {