mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 14:32:55 +08:00
Copy list content before firing events to avoid pollution
This commit is contained in:
parent
38babf3de5
commit
1027b608ff
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user