Browse Source

Remove node from parent when reparented.

When a control was move from one parent container to another, and that move caused the new parent container to be laid out in a different position, a code path was taken which resulted in the `VisualNode` being present under both the old and new containers.

Ensure that the node is removed from its old parent in this case.

Fixes #7381
Fixes #6103 (probably)
pull/8427/head
Steven Kirk 4 years ago
parent
commit
cfe572f30b
  1. 1
      src/Avalonia.Base/Rendering/SceneGraph/SceneBuilder.cs

1
src/Avalonia.Base/Rendering/SceneGraph/SceneBuilder.cs

@ -158,6 +158,7 @@ namespace Avalonia.Rendering.SceneGraph
if (result != null && result.Parent != parent)
{
Deindex(scene, result);
((VisualNode?)result.Parent)?.RemoveChild(result);
result = null;
}

Loading…
Cancel
Save