1
0
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:
Dan Balasescu 2022-08-05 15:16:22 +09:00 committed by GitHub
commit a81a2517b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 0 deletions

View File

@ -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();
}
}
}

View File

@ -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);

View File

@ -147,7 +147,10 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons
{
// beatmapset may have changed.
if (Preview != preview)
{
preview?.Dispose();
return;
}
AddInternal(preview);
loading = false;