From cf9c8120c5292774b8aec7d2b0282003cdca32d6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 31 Aug 2023 19:04:06 +0900 Subject: [PATCH] Fix potential race condition in song bar beatmap lookup flow Cancelling a web request may not necessarily cancel the callbacks. This might help with https://github.com/ppy/osu/issues/24598. --- osu.Game.Tournament/IPC/FileBasedIPC.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tournament/IPC/FileBasedIPC.cs b/osu.Game.Tournament/IPC/FileBasedIPC.cs index bf835122cc..5407c21079 100644 --- a/osu.Game.Tournament/IPC/FileBasedIPC.cs +++ b/osu.Game.Tournament/IPC/FileBasedIPC.cs @@ -92,8 +92,16 @@ namespace osu.Game.Tournament.IPC else { beatmapLookupRequest = new GetBeatmapRequest(new APIBeatmap { OnlineID = beatmapId }); - beatmapLookupRequest.Success += b => Beatmap.Value = new TournamentBeatmap(b); - beatmapLookupRequest.Failure += _ => Beatmap.Value = null; + beatmapLookupRequest.Success += b => + { + if (lastBeatmapId == beatmapId) + Beatmap.Value = new TournamentBeatmap(b); + }; + beatmapLookupRequest.Failure += _ => + { + if (lastBeatmapId == beatmapId) + Beatmap.Value = null; + }; API.Queue(beatmapLookupRequest); } }