mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 02:42:54 +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)
|
else if (filterMods)
|
||||||
requestMods = mods.Value;
|
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.
|
// Request may have changed since fetch request.
|
||||||
if (!fetchBeatmapInfo.Equals(BeatmapInfo))
|
// Can't rely on request cancellation due to Schedule inside SetScores so let's play it safe.
|
||||||
|
if (!newRequest.Equals(scoreRetrievalRequest))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SetScores(
|
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)
|
protected override LeaderboardScore CreateDrawableScore(ScoreInfo model, int index) => new LeaderboardScore(model, index, IsOnlineScope)
|
||||||
|
Loading…
Reference in New Issue
Block a user