fix(docking): improve structural integrity and add null validation

This commit is contained in:
2026-03-28 22:35:43 +09:00
parent e5aa328576
commit 1d48784a1c
3 changed files with 47 additions and 5 deletions

View File

@@ -57,10 +57,12 @@ public class DockPanel : DockContainer
if (owner != null)
{
int index = owner.Children.IndexOf(this);
owner.RemoveChild(this);
child.Detach();
owner.InsertChild(index, child);
owner.ReplaceChild(this, child);
}
else if (Root != null && Root.RootPanel == this)
{
// If this is the root panel, we can't easily replace it if the child is a DockGroup,
// because RootPanel must be a DockPanel. So we just leave it.
}
}
}