Преглед на файлове

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)
Steven Kirk преди 3 години
родител
ревизия
cfe572f30b
променени са 1 файла, в които са добавени 1 реда и са изтрити 0 реда
  1. 1 0
      src/Avalonia.Base/Rendering/SceneGraph/SceneBuilder.cs

+ 1 - 0
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;
             }