Editor: Fix infinite appending of docks without slots to config #113306
+7
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 keysdock_1throughdock_15). However, docks without default slots use index-1, which corresponds to the config keydock_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_0config key before saving closed docks, matching the behavior of regular dock slots.Testing
Tested with the reproduction steps provided in the issue:
EditorDockthat has no default slotdock_0in.godot/editor/editor_layout.cfgno longer accumulates duplicate entriesThe fix ensures that the special
-1slot is properly cleared on each save, preventing the infinite appending behavior.