From 0fa5e1b28e0e8d9b00ebe6d85fd6517b958a5656 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 23 Sep 2022 20:18:44 +0900 Subject: [PATCH] Fix intermittent leaderboard crash due to request finishing after drawable is disposed --- osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs b/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs index 0f6ac2b455..ffb13dc458 100644 --- a/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs +++ b/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs @@ -153,10 +153,11 @@ namespace osu.Game.Screens.Select.Leaderboards var req = new GetScoresRequest(fetchBeatmapInfo, fetchRuleset, Scope, requestMods); - req.Success += r => SetScores( + // Schedule is required to avoid potential object disposed exception when LoadComponentAsync is eventually called. + req.Success += r => Schedule(() => SetScores( scoreManager.OrderByTotalScore(r.Scores.Select(s => s.ToScoreInfo(rulesets, fetchBeatmapInfo))), r.UserScore?.CreateScoreInfo(rulesets, fetchBeatmapInfo) - ); + )); return req; }