1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 18:23:04 +08:00

Fix triangles intro attempting to restart track after it is disposed

This commit is contained in:
Dean Herbert 2021-09-10 18:10:03 +09:00
parent 5a06954665
commit 94702ee7e3

View File

@ -42,6 +42,7 @@ namespace osu.Game.Screens.Menu
private Sample welcome; private Sample welcome;
private DecoupleableInterpolatingFramedClock decoupledClock; private DecoupleableInterpolatingFramedClock decoupledClock;
private TrianglesIntroSequence intro;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
@ -66,7 +67,7 @@ namespace osu.Game.Screens.Menu
if (UsingThemedIntro) if (UsingThemedIntro)
decoupledClock.ChangeSource(Track); decoupledClock.ChangeSource(Track);
LoadComponentAsync(new TrianglesIntroSequence(logo, background) LoadComponentAsync(intro = new TrianglesIntroSequence(logo, background)
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Clock = decoupledClock, Clock = decoupledClock,
@ -82,6 +83,14 @@ namespace osu.Game.Screens.Menu
} }
} }
public override void OnSuspending(IScreen next)
{
base.OnSuspending(next);
// important as there is a clock attached to a track which will likely be disposed before returning to this screen.
intro.Expire();
}
public override void OnResuming(IScreen last) public override void OnResuming(IScreen last)
{ {
base.OnResuming(last); base.OnResuming(last);