Skip to content

armgit / godot

Public Imported from GitHub
0

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

Fix crash in Tree::_get_item_focus_rect

Mikea1fdb0accbf7
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index 01a1c9ebbfc..4d75ae7fbba 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -5160,7 +5160,10 @@ void Tree::_notification(int p_what) {
} break;
case NOTIFICATION_VISIBILITY_CHANGED: {
- drag_touching = false;
+ if (!is_visible()) {
+ drag_touching = false;
+ popup_editor->hide();
+ }
} break;
case NOTIFICATION_DRAG_END: {
@@ -5642,7 +5645,7 @@ void Tree::_notification(int p_what) {
case NOTIFICATION_RESIZED:
case NOTIFICATION_TRANSFORM_CHANGED: {
- if (popup_edited_item != nullptr) {
+ if (popup_edited_item != nullptr && popup_editor->is_visible()) {
Rect2 rect = _get_item_focus_rect(popup_edited_item);
popup_editor->set_position(get_screen_position() + rect.position);