Skip to content

Commit

Permalink
fix: Only set children parents to null on UIElement cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Youssef1313 authored Nov 28, 2023
1 parent 09b2490 commit 28edf67
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions src/Uno.UI/UI/Xaml/UIElement.skia.cs
Original file line number Diff line number Diff line change
Expand Up @@ -380,23 +380,9 @@ private void Cleanup()
{
NativeDispatcher.Main.Enqueue(() =>
{
if (this.GetParent() is UIElement originalParent)
for (var i = 0; i < _children.Count; i++)
{
originalParent.RemoveChild(this);
}
if (this is Panel panel)
{
panel.Children.Clear();
}
else
{
for (var i = 0; i < _children.Count; i++)
{
_children[i].SetParent(null);
}
_children.Clear();
_children[i].SetParent(null);
}
}, NativeDispatcherPriority.Idle);
}
Expand Down

0 comments on commit 28edf67

Please sign in to comment.