mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 21:47:25 +08:00
Merge pull request #19583 from peppy/fix-preview-track-disposal
Fix `PreviewTrack`s not being disposed correctly
This commit is contained in:
commit
a81a2517b2
@ -105,5 +105,11 @@ namespace osu.Game.Audio
|
||||
/// Retrieves the audio track.
|
||||
/// </summary>
|
||||
protected abstract Track? GetTrack();
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
Track?.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -118,7 +118,10 @@ namespace osu.Game.Beatmaps.Drawables.Cards.Buttons
|
||||
// another async load might have completed before this one.
|
||||
// if so, do not make any changes.
|
||||
if (loadedPreview != previewTrack)
|
||||
{
|
||||
loadedPreview.Dispose();
|
||||
return;
|
||||
}
|
||||
|
||||
AddInternal(loadedPreview);
|
||||
toggleLoading(false);
|
||||
|
@ -147,7 +147,10 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons
|
||||
{
|
||||
// beatmapset may have changed.
|
||||
if (Preview != preview)
|
||||
{
|
||||
preview?.Dispose();
|
||||
return;
|
||||
}
|
||||
|
||||
AddInternal(preview);
|
||||
loading = false;
|
||||
|
Loading…
Reference in New Issue
Block a user