From c01990d00587ba3f652ae4623c8a2d13de562860 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 1 Mar 2019 20:52:34 +0900 Subject: [PATCH] Fix callback potentially not getting fired --- osu.Game/Screens/Select/BeatmapClearScoresDialog.cs | 2 +- osu.Game/Screens/Select/SongSelect.cs | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs b/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs index 5fa50e00b9..a37327f2c3 100644 --- a/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs +++ b/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs @@ -29,7 +29,7 @@ public BeatmapClearScoresDialog(BeatmapInfo beatmap, Action onCompletion) Action = () => { Task.Run(() => scoreManager.Delete(scoreManager.QueryScores(s => !s.DeletePending && s.Beatmap.ID == beatmap.ID).ToList())) - .ContinueWith(t => Schedule(onCompletion)); + .ContinueWith(_ => onCompletion); } }, new PopupDialogCancelButton diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index c794d32d49..866c7e0926 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -625,7 +625,9 @@ private void clearScores(BeatmapInfo beatmap) { if (beatmap == null || beatmap.ID <= 0) return; - dialogOverlay?.Push(new BeatmapClearScoresDialog(beatmap, () => BeatmapDetails.Leaderboard.RefreshScores())); + dialogOverlay?.Push(new BeatmapClearScoresDialog(beatmap, () => + // schedule done here rather than inside the dialog as the dialog may fade out and never callback. + Schedule(() => BeatmapDetails.Leaderboard.RefreshScores()))); } public override bool OnPressed(GlobalAction action)