From 819b69f2c1e0aac273d5d57c1a0903496f02fa1b Mon Sep 17 00:00:00 2001 From: Eshaan Date: Sat, 29 Nov 2025 17:29:23 +1100 Subject: [PATCH] Editor: Fix infinite appending of docks without slots to config Docks without default slots (index -1, config key "dock_0") were being infinitely appended to the editor layout config because this special slot was never cleared before saving, unlike regular dock slots. This adds code to explicitly clear the dock_0 config key before saving closed docks, preventing infinite appending. --- editor/docks/editor_dock_manager.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/editor/docks/editor_dock_manager.cpp b/editor/docks/editor_dock_manager.cpp index 46d1b9b2ed2..d6d5f6106ce 100644 --- a/editor/docks/editor_dock_manager.cpp +++ b/editor/docks/editor_dock_manager.cpp @@ -600,6 +600,13 @@ void EditorDockManager::save_docks_to_config(Ref p_layout, const Str } } + // Clear the special dock slot for docks without default slots (index -1 = dock_0). + // This prevents closed docks from being infinitely appended to the config on each save. + const String no_slot_config_key = "dock_0"; + if (p_layout->has_section_key(p_section, no_slot_config_key)) { + p_layout->erase_section_key(p_section, no_slot_config_key); + } + // Save docks in windows. Dictionary floating_docks_dump; for (WindowWrapper *wrapper : dock_windows) {