mirror of
https://github.com/ppy/osu.git
synced 2024-11-13 22:47:26 +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.
|
/// Retrieves the audio track.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected abstract Track? GetTrack();
|
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.
|
// another async load might have completed before this one.
|
||||||
// if so, do not make any changes.
|
// if so, do not make any changes.
|
||||||
if (loadedPreview != previewTrack)
|
if (loadedPreview != previewTrack)
|
||||||
|
{
|
||||||
|
loadedPreview.Dispose();
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
AddInternal(loadedPreview);
|
AddInternal(loadedPreview);
|
||||||
toggleLoading(false);
|
toggleLoading(false);
|
||||||
|
@ -147,7 +147,10 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons
|
|||||||
{
|
{
|
||||||
// beatmapset may have changed.
|
// beatmapset may have changed.
|
||||||
if (Preview != preview)
|
if (Preview != preview)
|
||||||
|
{
|
||||||
|
preview?.Dispose();
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
AddInternal(preview);
|
AddInternal(preview);
|
||||||
loading = false;
|
loading = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user