mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 18:33:22 +08:00
Merge pull request #12892 from smoogipoo/force-end-playing
Forcefully trigger EndPlaying() to fix test failures
This commit is contained in:
commit
a37520d5ba
@ -174,6 +174,9 @@ namespace osu.Game.Online.Spectator
|
||||
|
||||
public void EndPlaying()
|
||||
{
|
||||
if (!IsPlaying)
|
||||
return;
|
||||
|
||||
IsPlaying = false;
|
||||
currentBeatmap = null;
|
||||
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user