1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 06:57:39 +08:00

Copy list content before firing events to avoid pollution

This commit is contained in:
Dean Herbert 2020-10-08 17:52:49 +09:00
parent 38babf3de5
commit 1027b608ff

View File

@ -237,13 +237,19 @@ namespace osu.Game.Screens.Edit
beatmapProcessor?.PostProcess();
foreach (var h in batchPendingDeletes) HitObjectRemoved?.Invoke(h);
foreach (var h in batchPendingInserts) HitObjectAdded?.Invoke(h);
foreach (var h in batchPendingUpdates) HitObjectUpdated?.Invoke(h);
// callbacks may modify the lists so let's be safe about it
var deletes = batchPendingDeletes.ToArray();
batchPendingDeletes.Clear();
var inserts = batchPendingInserts.ToArray();
batchPendingInserts.Clear();
var updates = batchPendingUpdates.ToArray();
batchPendingUpdates.Clear();
foreach (var h in deletes) HitObjectRemoved?.Invoke(h);
foreach (var h in inserts) HitObjectAdded?.Invoke(h);
foreach (var h in updates) HitObjectUpdated?.Invoke(h);
}
/// <summary>