Skip to content

Commit 8d6075d

Browse files
committed
fix(layout_update): Fixed a potiential "Layout cycle detected." exception
1 parent 16c0b87 commit 8d6075d

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/Uno.UI/UI/Xaml/UIElement.Layout.netstd.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,12 +296,13 @@ public void Arrange(Rect finalRect)
296296
{
297297
LayoutInformation.SetLayoutSlot(this, finalRect);
298298
HideVisual();
299-
ClearLayoutFlags(LayoutFlag.ArrangeDirty);
299+
ClearLayoutFlags(LayoutFlag.ArrangeDirty | LayoutFlag.ArrangeDirtyPath);
300300
return;
301301
}
302302

303303
if (!IsArrangeDirtyOrArrangeDirtyPath && finalRect == LayoutSlot)
304304
{
305+
ClearLayoutFlags(LayoutFlag.ArrangeDirty | LayoutFlag.ArrangeDirtyPath);
305306
return; // Calling Arrange would be a waste of CPU time here.
306307
}
307308

src/Uno.UI/UI/Xaml/UIElement.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ private static void InnerUpdateLayout(UIElement root)
552552
}
553553
}
554554
#else
555-
for (var i = 0; i < MaxLayoutIterations; i++)
555+
for (var i = MaxLayoutIterations; i > 0; i--)
556556
{
557557
if (root.IsMeasureDirtyOrMeasureDirtyPath)
558558
{

0 commit comments

Comments
 (0)