mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 23:53:51 +09:00
Use request cancellation and IsDisposed
guard instead of more Schedule
This commit is contained in:
@ -185,10 +185,15 @@ namespace osu.Game.Online.Leaderboards
|
||||
if (scores != null)
|
||||
this.scores.AddRange(scores);
|
||||
|
||||
// Schedule needs to be non-delayed here for the weird logic in refetchScores to work.
|
||||
// If it is removed, the placeholder will be incorrectly updated to "no scores" rather than "retrieving".
|
||||
// This whole flow should be refactored in the future.
|
||||
Scheduler.Add(applyNewScores, false);
|
||||
// Non-delayed schedule may potentially run inline (due to IsMainThread check passing) after leaderboard is disposed.
|
||||
// This is guarded against in BeatmapLeaderboard via web request cancellation, but let's be extra safe.
|
||||
if (!IsDisposed)
|
||||
{
|
||||
// Schedule needs to be non-delayed here for the weird logic in refetchScores to work.
|
||||
// If it is removed, the placeholder will be incorrectly updated to "no scores" rather than "retrieving".
|
||||
// This whole flow should be refactored in the future.
|
||||
Scheduler.Add(applyNewScores, false);
|
||||
}
|
||||
|
||||
void applyNewScores()
|
||||
{
|
||||
|
Reference in New Issue
Block a user