From 73b7f6bf0746f1d63f036df80892c37dfdd68504 Mon Sep 17 00:00:00 2001 From: Fabio Pozzi Date: Fri, 5 Jul 2024 09:07:44 +0200 Subject: [PATCH] Fixed iteration of growl panel children Fixed a possible exception that raise if you close the children of the growl panel while a new child is added. --- src/Shared/HandyControl_Shared/Controls/Growl/Growl.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Shared/HandyControl_Shared/Controls/Growl/Growl.cs b/src/Shared/HandyControl_Shared/Controls/Growl/Growl.cs index 7a102853c..28ce77fb8 100644 --- a/src/Shared/HandyControl_Shared/Controls/Growl/Growl.cs +++ b/src/Shared/HandyControl_Shared/Controls/Growl/Growl.cs @@ -295,7 +295,7 @@ private static void InitGrowlPanel(Panel panel) menuItem.Click += (s, e) => { - foreach (var item in panel.Children.OfType()) + foreach (var item in panel.Children.OfType().ToArray()) { item.Close(false); } @@ -863,7 +863,7 @@ private void Close(bool invokeParam) { if (GrowlPanel != null && GrowlPanel.Children.Count == 0 && GetIsCreatedAutomatically(GrowlPanel)) { - // If the count of children is zero, we need to remove the panel, provided that the panel was created automatically + // If the count of children is zero, we need to remove the panel, provided that the panel was created automatically RemoveDefaultPanel(GrowlPanel); GrowlPanel = null; }