From d5fc004df0d149452e873040102f1e98cb929a2d Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Tue, 11 Feb 2020 21:59:51 +0100 Subject: [PATCH] Prevent reentrancy in ExecuteInitialLayoutPass. Fixes #3550. --- src/Avalonia.Layout/LayoutManager.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Avalonia.Layout/LayoutManager.cs b/src/Avalonia.Layout/LayoutManager.cs index 1792655a13..69a4406828 100644 --- a/src/Avalonia.Layout/LayoutManager.cs +++ b/src/Avalonia.Layout/LayoutManager.cs @@ -132,8 +132,16 @@ namespace Avalonia.Layout /// public void ExecuteInitialLayoutPass(ILayoutRoot root) { - Measure(root); - Arrange(root); + try + { + _running = true; + Measure(root); + Arrange(root); + } + finally + { + _running = false; + } // Running the initial layout pass may have caused some control to be invalidated // so run a full layout pass now (this usually due to scrollbars; its not known