mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 09:32:55 +08:00
Harden request equality checks
This commit is contained in:
parent
96e81e7f41
commit
beb3b96aca
@ -152,12 +152,14 @@ namespace osu.Game.Screens.Select.Leaderboards
|
||||
else if (filterMods)
|
||||
requestMods = mods.Value;
|
||||
|
||||
scoreRetrievalRequest = new GetScoresRequest(fetchBeatmapInfo, fetchRuleset, Scope, requestMods);
|
||||
scoreRetrievalRequest?.Cancel();
|
||||
|
||||
scoreRetrievalRequest.Success += response => Schedule(() =>
|
||||
var newRequest = new GetScoresRequest(fetchBeatmapInfo, fetchRuleset, Scope, requestMods);
|
||||
newRequest.Success += response => Schedule(() =>
|
||||
{
|
||||
// Beatmap may have changed since fetch request. Can't rely on request cancellation due to Schedule inside SetScores.
|
||||
if (!fetchBeatmapInfo.Equals(BeatmapInfo))
|
||||
// Request may have changed since fetch request.
|
||||
// Can't rely on request cancellation due to Schedule inside SetScores so let's play it safe.
|
||||
if (!newRequest.Equals(scoreRetrievalRequest))
|
||||
return;
|
||||
|
||||
SetScores(
|
||||
@ -166,7 +168,7 @@ namespace osu.Game.Screens.Select.Leaderboards
|
||||
);
|
||||
});
|
||||
|
||||
return scoreRetrievalRequest;
|
||||
return scoreRetrievalRequest = newRequest;
|
||||
}
|
||||
|
||||
protected override LeaderboardScore CreateDrawableScore(ScoreInfo model, int index) => new LeaderboardScore(model, index, IsOnlineScope)
|
||||
|
Loading…
Reference in New Issue
Block a user