From c928700febf564fcd8408d64dda61f838c4a09c9 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Thu, 14 May 2020 21:24:44 -0300 Subject: [PATCH] make copy of list before enumerating. --- src/Avalonia.Controls/Window.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Avalonia.Controls/Window.cs b/src/Avalonia.Controls/Window.cs index 4b6df20363..07e3d78650 100644 --- a/src/Avalonia.Controls/Window.cs +++ b/src/Avalonia.Controls/Window.cs @@ -376,7 +376,7 @@ namespace Avalonia.Controls private void CloseInternal () { - foreach(var child in _children) + foreach(var child in _children.ToList()) { // if we HandleClosing() before then there will be no children. child.CloseInternal();