1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 08:02:55 +08:00

Forcefully end playing to fix test failures

This commit is contained in:
smoogipoo 2021-05-21 14:09:30 +09:00
parent 07221c55b2
commit 895eb14c5a
2 changed files with 12 additions and 0 deletions

View File

@ -174,6 +174,9 @@ namespace osu.Game.Online.Spectator
public void EndPlaying()
{
if (!IsPlaying)
return;
IsPlaying = false;
currentBeatmap = null;

View File

@ -22,6 +22,7 @@ using osu.Game.Configuration;
using osu.Game.Graphics.Containers;
using osu.Game.IO.Archives;
using osu.Game.Online.API;
using osu.Game.Online.Spectator;
using osu.Game.Overlays;
using osu.Game.Replays;
using osu.Game.Rulesets;
@ -93,6 +94,9 @@ namespace osu.Game.Screens.Play
[Resolved]
private MusicController musicController { get; set; }
[Resolved]
private SpectatorClient spectatorClient { get; set; }
private Sample sampleRestart;
public BreakOverlay BreakOverlay;
@ -882,6 +886,11 @@ namespace osu.Game.Screens.Play
return true;
}
// EndPlaying() is typically called from ReplayRecorder.Dispose(). Disposal is currently asynchronous.
// To resolve test failures, forcefully end playing synchronously when this screen exits.
// Todo: Replace this with a more permanent solution once osu-framework has a synchronous cleanup method.
spectatorClient.EndPlaying();
// GameplayClockContainer performs seeks / start / stop operations on the beatmap's track.
// as we are no longer the current screen, we cannot guarantee the track is still usable.
(GameplayClockContainer as MasterGameplayClockContainer)?.StopUsingBeatmapClock();