1
0
mirror of https://github.com/godotengine/godot.git synced 2026-01-07 19:53:17 +00:00

Merge pull request #93292 from rune-scape/singleton-cleanup

Fix missing cleanup and null checks for various singletons
This commit is contained in:
Rémi Verschelde
2024-06-18 14:09:01 +02:00
6 changed files with 18 additions and 4 deletions

View File

@@ -3539,7 +3539,7 @@ void EditorNode::add_extension_editor_plugin(const StringName &p_class_name) {
void EditorNode::remove_extension_editor_plugin(const StringName &p_class_name) {
// If we're exiting, the editor plugins will get cleaned up anyway, so don't do anything.
if (singleton->exiting) {
if (!singleton || singleton->exiting) {
return;
}

View File

@@ -8431,6 +8431,7 @@ Node3DEditor::Node3DEditor() {
VBoxContainer *vbc = this;
custom_camera = nullptr;
ERR_FAIL_COND_MSG(singleton != nullptr, "A Node3DEditor singleton already exists.");
singleton = this;
editor_selection = EditorNode::get_singleton()->get_editor_selection();
editor_selection->add_editor_plugin(this);
@@ -9060,6 +9061,7 @@ void fragment() {
clear(); // Make sure values are initialized. Will call _snap_update() for us.
}
Node3DEditor::~Node3DEditor() {
singleton = nullptr;
memdelete(preview_node);
if (preview_sun_dangling && preview_sun) {
memdelete(preview_sun);