summaryrefslogtreecommitdiff
path: root/editor/editor_node.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/editor_node.cpp')
-rw-r--r--editor/editor_node.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 9169227e8a..719130621e 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -494,7 +494,7 @@ void EditorNode::_fs_changed() {
}
}
- get_tree()->quit();
+ _exit_editor();
}
}
@@ -1120,7 +1120,7 @@ void EditorNode::save_all_scenes_and_restart() {
to_reopen = get_tree()->get_edited_scene_root()->get_filename();
}
- get_tree()->quit();
+ _exit_editor();
String exec = OS::get_singleton()->get_executable_path();
List<String> args;
@@ -2356,6 +2356,12 @@ int EditorNode::_next_unsaved_scene(bool p_valid_filename, int p_start) {
return -1;
}
+void EditorNode::_exit_editor() {
+ exiting = true;
+ resource_preview->stop(); //stop early to avoid crashes
+ get_tree()->quit();
+}
+
void EditorNode::_discard_changes(const String &p_str) {
switch (current_option) {
@@ -2383,14 +2389,13 @@ void EditorNode::_discard_changes(const String &p_str) {
case FILE_QUIT: {
_menu_option_confirm(RUN_STOP, true);
- exiting = true;
- get_tree()->quit();
+ _exit_editor();
+
} break;
case RUN_PROJECT_MANAGER: {
_menu_option_confirm(RUN_STOP, true);
- exiting = true;
- get_tree()->quit();
+ _exit_editor();
String exec = OS::get_singleton()->get_executable_path();
List<String> args;