1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-19 21:52:54 +08:00

Fix scheduled calls piling up during transactions

This commit is contained in:
Dean Herbert 2023-04-06 23:39:36 +09:00
parent 9c8b25e034
commit ad717d2368

View File

@ -6,6 +6,7 @@ using osu.Framework.Allocation;
using osu.Framework.Extensions.TypeExtensions; using osu.Framework.Extensions.TypeExtensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Threading;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
using osu.Game.Overlays; using osu.Game.Overlays;
@ -47,9 +48,13 @@ namespace osu.Game.Rulesets.Edit
EditorBeatmap.TransactionEnded += updateInspectorText; EditorBeatmap.TransactionEnded += updateInspectorText;
} }
private ScheduledDelegate? rollingTextUpdate;
private void updateInspectorText() private void updateInspectorText()
{ {
inspectorText.Clear(); inspectorText.Clear();
rollingTextUpdate?.Cancel();
rollingTextUpdate = null;
switch (EditorBeatmap.SelectedHitObjects.Count) switch (EditorBeatmap.SelectedHitObjects.Count)
{ {
@ -108,7 +113,7 @@ namespace osu.Game.Rulesets.Edit
// I'd hope there's a better way to do this, but I don't want to bind to each and every property above to watch for changes. // I'd hope there's a better way to do this, but I don't want to bind to each and every property above to watch for changes.
// This is a good middle-ground for the time being. // This is a good middle-ground for the time being.
Scheduler.AddDelayed(updateInspectorText, 250); rollingTextUpdate ??= Scheduler.AddDelayed(updateInspectorText, 250);
break; break;
default: default: