Skip to content

Fix EditorPlugin::remove_control_from_docks freeing passed control#117337

Merged
Repiteo merged 1 commit into
godotengine:masterfrom
kleonc:editor_plugin_remove_from_docks_dont_free_the_control
Jun 1, 2026
Merged

Fix EditorPlugin::remove_control_from_docks freeing passed control#117337
Repiteo merged 1 commit into
godotengine:masterfrom
kleonc:editor_plugin_remove_from_docks_dont_free_the_control

Conversation

@kleonc
Copy link
Copy Markdown
Member

@kleonc kleonc commented Mar 11, 2026

Fixes #117331.

Fixes a regression from #106503 which made remove_control_from_docks(docked_control) result in freeing the passed docked_control.

After #106503 when a Control is added to a dock with add_control_from_dock it is wrapped into an EditorDock node by adding it as its child. On remove_control_from_docks such EditorDock is freed, but the wrapped control was never being removed from it, hence it was freed together with its parent. This is a regresion / compatibilty breakage, as remove_control_from_docks is documented to not free the passed control and tells clearly it's the user responsibility.

<method name="remove_control_from_docks" deprecated="Use [method remove_dock] instead.">
<return type="void" />
<param index="0" name="control" type="Control" />
<description>
Removes the control from the dock. You have to manually [method Node.queue_free] the control.
</description>

@kleonc kleonc requested a review from KoBeWi March 11, 2026 20:33
@kleonc kleonc requested a review from a team as a code owner March 11, 2026 20:33
@kleonc kleonc added bug topic:editor topic:plugin regression cherrypick:4.6 Considered for cherry-picking into a future 4.6.x release labels Mar 11, 2026
@kleonc kleonc force-pushed the editor_plugin_remove_from_docks_dont_free_the_control branch from 0c11fe2 to b7f9305 Compare March 11, 2026 20:41
Comment thread editor/plugins/editor_plugin.cpp Outdated
@kleonc kleonc force-pushed the editor_plugin_remove_from_docks_dont_free_the_control branch from b7f9305 to e4a5d61 Compare March 11, 2026 23:47
@Nintorch Nintorch added this to the 4.7 milestone Mar 12, 2026
@kleonc kleonc requested a review from KoBeWi June 1, 2026 12:46
@kleonc kleonc force-pushed the editor_plugin_remove_from_docks_dont_free_the_control branch from e4a5d61 to cdc278d Compare June 1, 2026 12:47
@Repiteo Repiteo merged commit 24028e8 into godotengine:master Jun 1, 2026
20 checks passed
@Repiteo
Copy link
Copy Markdown
Contributor

Repiteo commented Jun 1, 2026

Thanks!

@kleonc kleonc deleted the editor_plugin_remove_from_docks_dont_free_the_control branch June 1, 2026 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug cherrypick:4.6 Considered for cherry-picking into a future 4.6.x release regression topic:editor topic:plugin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Crash when adding a dock to DOCK_SLOT_RIGHT_BL

4 participants