Improved Widget.RemoveChildren performance
Modifying the list potentially several thousand times is really slow, so notify the child elements that they are being removed and then clear the list in one go.
This commit is contained in:
@@ -524,8 +524,10 @@ namespace OpenRA.Widgets
|
||||
|
||||
public virtual void RemoveChildren()
|
||||
{
|
||||
while (Children.Count > 0)
|
||||
RemoveChild(Children[Children.Count - 1]);
|
||||
foreach (var child in Children)
|
||||
child?.Removed();
|
||||
|
||||
Children.Clear();
|
||||
}
|
||||
|
||||
public virtual void Hidden()
|
||||
|
||||
Reference in New Issue
Block a user