Skip to content

Conversation

@Eshaan-byte
Copy link
Contributor

Summary

Fixes #113281

This PR fixes a bug where docks without default slots were being infinitely appended to the editor layout config file.

Root Cause

The clearing loop at lines 574-601 only clears dock slots 0 through DOCK_SLOT_MAX (generating config keys dock_1 through dock_15). However, docks without default slots use index -1, which corresponds to the config key dock_0. This key was never cleared, so closed docks kept getting appended infinitely on each save.

Changes Made

Added code after line 601 to explicitly clear the dock_0 config key before saving closed docks, matching the behavior of regular dock slots.

Testing

Tested with the reproduction steps provided in the issue:

  1. Created a plugin with an EditorDock that has no default slot
  2. Enabled the plugin
  3. Pressed Ctrl+S multiple times
  4. Verified that dock_0 in .godot/editor/editor_layout.cfg no longer accumulates duplicate entries

The fix ensures that the special -1 slot is properly cleared on each save, preventing the infinite appending behavior.

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.
@akien-mga akien-mga added this to the 4.6 milestone Dec 1, 2025
@akien-mga akien-mga merged commit da3233a into godotengine:master Dec 1, 2025
20 checks passed
@akien-mga
Copy link
Member

Thanks! And congrats for your first merged Godot contribution 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docks without slots will be infinitely appended to dock list

4 participants