From 7aafdadae51fcffd9dba27c2e91661b6248f3c47 Mon Sep 17 00:00:00 2001 From: Regalis Date: Fri, 24 Feb 2017 19:16:42 +0200 Subject: [PATCH] (Maybe?) fixed "collection was modified" exceptions in GUIComponent.AddToGUIUpdateList http://undertowgames.com/forum/viewtopic.php?f=21&t=5915 Couldn't reproduce the exception and not sure why exactly it happens, but I think this should prevent it --- Subsurface/Source/GUI/GUIComponent.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Subsurface/Source/GUI/GUIComponent.cs b/Subsurface/Source/GUI/GUIComponent.cs index f48325221..b059c8267 100644 --- a/Subsurface/Source/GUI/GUIComponent.cs +++ b/Subsurface/Source/GUI/GUIComponent.cs @@ -28,7 +28,12 @@ namespace Barotrauma if (!Visible) return; if (ComponentsToUpdate.Contains(this)) return; ComponentsToUpdate.Add(this); - children.ForEach(c => c.AddToGUIUpdateList()); + + List fixedChildren = new List(children); + foreach (GUIComponent c in fixedChildren) + { + c.AddToGUIUpdateList(); + } } public static void ClearUpdateList()