fix(docking): address code quality issues in Docking system

This commit is contained in:
2026-03-28 22:43:44 +09:00
parent d367cff79f
commit e6d0529ef1
3 changed files with 7 additions and 8 deletions

View File

@@ -53,14 +53,7 @@ public abstract class DockContainer : DockModule
if (_children.Contains(module)) if (_children.Contains(module))
return; return;
if (module.Owner == this) module.Owner?.RemoveChild(module);
{
RemoveChildInternal(module, false);
}
else
{
module.Owner?.RemoveChild(module);
}
module.Owner = this; module.Owner = this;
module.Root = Root; module.Root = Root;

View File

@@ -63,6 +63,7 @@ public class DockPanel : DockContainer
{ {
if (child is DockPanel childPanel) if (child is DockPanel childPanel)
{ {
RemoveChildInternal(childPanel, false);
Root.RootPanel = childPanel; Root.RootPanel = childPanel;
} }
} }

View File

@@ -59,6 +59,11 @@ public class DockingLayout : Control
throw new InvalidOperationException("Panel is already owned by another DockingLayout"); throw new InvalidOperationException("Panel is already owned by another DockingLayout");
} }
if (newPanel.Owner != null)
{
newPanel.Owner.RemoveChild(newPanel);
}
newPanel.Root = layout; newPanel.Root = layout;
} }
} }