(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
This commit is contained in:
Regalis
2017-02-24 19:16:42 +02:00
parent b8c3b9c29f
commit 7aafdadae5

View File

@@ -28,7 +28,12 @@ namespace Barotrauma
if (!Visible) return;
if (ComponentsToUpdate.Contains(this)) return;
ComponentsToUpdate.Add(this);
children.ForEach(c => c.AddToGUIUpdateList());
List<GUIComponent> fixedChildren = new List<GUIComponent>(children);
foreach (GUIComponent c in fixedChildren)
{
c.AddToGUIUpdateList();
}
}
public static void ClearUpdateList()