Skip to content

armgit / godot

Public Imported from GitHub
0

Godot Engine – Multi-platform 2D and 3D game engine

Fix crash by releasing stale gizmo reference after switching scenes

Nagy E0ad88f28d994
diff --git a/editor/scene/3d/node_3d_editor_gizmos.cpp b/editor/scene/3d/node_3d_editor_gizmos.cpp
index df925fb0bda..9f464fbb595 100644
--- a/editor/scene/3d/node_3d_editor_gizmos.cpp
+++ b/editor/scene/3d/node_3d_editor_gizmos.cpp
@@ -46,6 +46,7 @@
bool EditorNode3DGizmo::is_editable() const {
ERR_FAIL_NULL_V(spatial_node, false);
+ ERR_FAIL_COND_V(!spatial_node->is_inside_tree(), false);
Node *edited_root = spatial_node->get_tree()->get_edited_scene_root();
if (spatial_node == edited_root) {
return true;
diff --git a/editor/scene/3d/path_3d_editor_plugin.cpp b/editor/scene/3d/path_3d_editor_plugin.cpp
index 06d7ae99e1d..442fbe9c2bf 100644
--- a/editor/scene/3d/path_3d_editor_plugin.cpp
+++ b/editor/scene/3d/path_3d_editor_plugin.cpp
@@ -794,6 +794,7 @@ void Path3DEditorPlugin::update_handles() {
void Path3DEditorPlugin::edit(Object *p_object) {
if (path) {
path->disconnect("curve_changed", callable_mp(this, &Path3DEditorPlugin::_update_toolbar));
+ _edit.gizmo.unref();
}
path = Object::cast_to<Path3D>(p_object);