From acf0d395c80f730b56673eb33a3e51ec3c3bbaae Mon Sep 17 00:00:00 2001 From: Zae Date: Wed, 18 Oct 2023 01:14:26 +0800 Subject: [PATCH] Editor: Fix `remove_control_from_dock` fails when dock is floating. --- editor/editor_node.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index dd3198954d2..910d50e28e6 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -5850,6 +5850,14 @@ void EditorNode::add_control_to_dock(DockSlot p_slot, Control *p_control) { } void EditorNode::remove_control_from_dock(Control *p_control) { + // If the dock is floating, close it first. + for (WindowWrapper *wrapper : floating_docks) { + if (p_control == wrapper->get_wrapped_control()) { + wrapper->set_window_enabled(false); + break; + } + } + Control *dock = nullptr; for (int i = 0; i < DOCK_SLOT_MAX; i++) { if (p_control->get_parent() == dock_slot[i]) {