mirror of
https://github.com/ppy/osu.git
synced 2025-03-15 20:47:25 +08:00
Fix StopUsingBeatmapClock()
applying adjustments to track it was supposed to stop using
- Closes https://github.com/ppy/osu/issues/25248 - Possibly also closes https://github.com/ppy/osu/issues/20475 Regressed in e33486a766044c17c2f254f5e8df6d72b29c341e. `StopUsingBeatmapClock()` intends to, as the name says, stop operating on the working beatmap clock to yield its usage to other components on exit. As part of that it tries to unapply audio adjustments so that other screens can apply theirs freely instead. However, the aforementioned commit introduced a bug in this. Previously to it, `track` was an alias for the `SourceClock`, which could be mutated in an indirect way via `ChangeSource()` calls. The aforementioned commit made `track` a `readonly` field, initialised in constructor, which would _never_ change value. In particular, it would _always_ be the beatmap track, which meant that `StopUsingBeatmapClock()` would remove the adjustments from the beatmap track, but then at the end of the method, _apply them onto that same track again_. This was only saved by the fact that clock adjustments are removed again on disposal of the `MasterGameplayClockContainer()`. This - due to async disposal pressure - could explain infrequently reported cases wherein the track would just continue to speed up ad infinitum. To fix, fully substitute the beatmap track for a virtual track at the point of calling `StopUsingBeatmapClock()`.
This commit is contained in:
parent
0482c05d7c
commit
565ae99e0d
@ -41,7 +41,7 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
private readonly WorkingBeatmap beatmap;
|
||||
|
||||
private readonly Track track;
|
||||
private Track track;
|
||||
|
||||
private readonly double skipTargetTime;
|
||||
|
||||
@ -188,11 +188,11 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
removeSourceClockAdjustments();
|
||||
|
||||
var virtualTrack = new TrackVirtual(beatmap.Track.Length);
|
||||
virtualTrack.Seek(CurrentTime);
|
||||
track = new TrackVirtual(beatmap.Track.Length);
|
||||
track.Seek(CurrentTime);
|
||||
if (IsRunning)
|
||||
virtualTrack.Start();
|
||||
ChangeSource(virtualTrack);
|
||||
track.Start();
|
||||
ChangeSource(track);
|
||||
|
||||
addSourceClockAdjustments();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user