1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 16:12:57 +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(); beatmapProcessor?.PostProcess();
foreach (var h in batchPendingDeletes) HitObjectRemoved?.Invoke(h); // callbacks may modify the lists so let's be safe about it
foreach (var h in batchPendingInserts) HitObjectAdded?.Invoke(h); var deletes = batchPendingDeletes.ToArray();
foreach (var h in batchPendingUpdates) HitObjectUpdated?.Invoke(h);
batchPendingDeletes.Clear(); batchPendingDeletes.Clear();
var inserts = batchPendingInserts.ToArray();
batchPendingInserts.Clear(); batchPendingInserts.Clear();
var updates = batchPendingUpdates.ToArray();
batchPendingUpdates.Clear(); 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> /// <summary>