Skip to content

Commit

Permalink
fix(layout_update): Fixed a potiential "Layout cycle detected." excep…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
carldebilly committed Mar 28, 2022
1 parent 16c0b87 commit 8d6075d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/Uno.UI/UI/Xaml/UIElement.Layout.netstd.cs
Original file line number Diff line number Diff line change
Expand Up @@ -296,12 +296,13 @@ public void Arrange(Rect finalRect)
{
LayoutInformation.SetLayoutSlot(this, finalRect);
HideVisual();
ClearLayoutFlags(LayoutFlag.ArrangeDirty);
ClearLayoutFlags(LayoutFlag.ArrangeDirty | LayoutFlag.ArrangeDirtyPath);
return;
}

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

Expand Down
2 changes: 1 addition & 1 deletion src/Uno.UI/UI/Xaml/UIElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ private static void InnerUpdateLayout(UIElement root)
}
}
#else
for (var i = 0; i < MaxLayoutIterations; i++)
for (var i = MaxLayoutIterations; i > 0; i--)
{
if (root.IsMeasureDirtyOrMeasureDirtyPath)
{
Expand Down

0 comments on commit 8d6075d

Please sign in to comment.