Skip to content

Commit

Permalink
Avoid crash on exiting due to late prints
Browse files Browse the repository at this point in the history
  • Loading branch information
RandomShaper committed Aug 2, 2023
1 parent dca12c2 commit b3a5e10
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions editor/editor_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6730,6 +6730,9 @@ void EditorNode::_print_handler(void *p_this, const String &p_string, bool p_err
}

void EditorNode::_print_handler_impl(const String &p_string, bool p_error, bool p_rich) {
if (!singleton) {
return;
}
if (p_error) {
singleton->log->add_message(p_string, EditorLog::MSG_TYPE_ERROR);
} else if (p_rich) {
Expand Down Expand Up @@ -6845,6 +6848,7 @@ EditorNode::EditorNode() {
DisplayServer::get_singleton()->cursor_set_custom_image(Ref<Resource>());
}

DEV_ASSERT(!singleton);
singleton = this;

EditorUndoRedoManager::get_singleton()->connect("version_changed", callable_mp(this, &EditorNode::_update_undo_redo_allowed));
Expand Down Expand Up @@ -8210,6 +8214,8 @@ EditorNode::~EditorNode() {

GDExtensionEditorPlugins::editor_node_add_plugin = nullptr;
GDExtensionEditorPlugins::editor_node_remove_plugin = nullptr;

singleton = nullptr;
}

/*
Expand Down

0 comments on commit b3a5e10

Please sign in to comment.