mirror of
https://github.com/ppy/osu.git
synced 2025-03-25 03:07:34 +08:00
Dispose track on dispose
This commit is contained in:
parent
4c5d4752b1
commit
72ebcb157f
@ -3,6 +3,7 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio.Track;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Beatmaps;
|
||||
@ -22,13 +23,15 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
|
||||
[Cached]
|
||||
private readonly Bindable<IReadOnlyList<Mod>> mods = new Bindable<IReadOnlyList<Mod>>();
|
||||
|
||||
private readonly Track track;
|
||||
|
||||
public GameplayIsolationContainer(WorkingBeatmap beatmap, RulesetInfo ruleset, IReadOnlyList<Mod> mods)
|
||||
{
|
||||
this.beatmap.Value = beatmap;
|
||||
this.ruleset.Value = ruleset;
|
||||
this.mods.Value = mods;
|
||||
|
||||
beatmap.LoadTrack();
|
||||
track = beatmap.LoadTrack();
|
||||
}
|
||||
|
||||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
||||
@ -39,5 +42,11 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
|
||||
dependencies.CacheAs(mods.BeginLease(false));
|
||||
return dependencies;
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
track?.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user