1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 12:57:36 +08:00

Fix disposal rather than performing some weird hack

This commit is contained in:
Dean Herbert 2021-03-19 20:30:52 +09:00
parent f59327cc3e
commit 68aaf90702
2 changed files with 3 additions and 9 deletions

View File

@ -509,7 +509,7 @@ namespace osu.Game.Skinning
/// <summary> /// <summary>
/// A sample wrapper which keeps a reference to the contained skin to avoid finalizer garbage collection of the managing SampleStore. /// A sample wrapper which keeps a reference to the contained skin to avoid finalizer garbage collection of the managing SampleStore.
/// </summary> /// </summary>
private class LegacySkinSample : ISample private class LegacySkinSample : ISample, IDisposable
{ {
private readonly Sample sample; private readonly Sample sample;
@ -575,6 +575,8 @@ namespace osu.Game.Skinning
public IBindable<double> AggregateFrequency => sample.AggregateFrequency; public IBindable<double> AggregateFrequency => sample.AggregateFrequency;
public IBindable<double> AggregateTempo => sample.AggregateTempo; public IBindable<double> AggregateTempo => sample.AggregateTempo;
public void Dispose() => sample.Dispose();
} }
} }
} }

View File

@ -83,14 +83,6 @@ namespace osu.Game.Skinning
bool wasPlaying = Playing; bool wasPlaying = Playing;
if (activeChannel != null)
{
// when switching away from previous samples, we don't want to call Stop() on them as it sounds better to let them play out.
// this may change in the future if we use PoolableSkinSample in more locations than gameplay.
// we *do* want to turn off looping, else we end up with an infinite looping sample running in the background.
activeChannel.Looping = false;
}
sampleContainer.Clear(); sampleContainer.Clear();
Sample = null; Sample = null;