Fix callback potentially not getting fired

This commit is contained in:
Dean Herbert 2019-03-01 20:52:34 +09:00
parent 19ce1f2869
commit c01990d005
2 changed files with 4 additions and 2 deletions

View File

@ -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

View File

@ -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)