Browse Source

Handle detached controls in layout pass.

Controls can still be queued for layout after they've been removed from
the visual tree.
Steven Kirk 10 năm trước cách đây
mục cha
commit
b72f08354a
1 tập tin đã thay đổi với 2 bổ sung2 xóa
  1. 2 2
      src/Perspex.Layout/LayoutManager.cs

+ 2 - 2
src/Perspex.Layout/LayoutManager.cs

@@ -276,12 +276,12 @@ namespace Perspex.Layout
                         {
                             var control = item.Control;
 
-                            while (control.PreviousArrange == null)
+                            while (control != null && control.PreviousArrange == null)
                             {
                                 control = control.GetVisualParent<ILayoutable>();
                             }
 
-                            if (control.GetVisualRoot() == Root)
+                            if (control != null && control.GetVisualRoot() == Root)
                             {
                                 control.Arrange(control.PreviousArrange.Value, true);
                             }