From 68aaf90702458f288913e191c4d27c342aa7a358 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 19 Mar 2021 20:30:52 +0900 Subject: [PATCH] Fix disposal rather than performing some weird hack --- osu.Game/Skinning/LegacySkin.cs | 4 +++- osu.Game/Skinning/PoolableSkinnableSample.cs | 8 -------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/osu.Game/Skinning/LegacySkin.cs b/osu.Game/Skinning/LegacySkin.cs index b69e99773c..ec49d43c67 100644 --- a/osu.Game/Skinning/LegacySkin.cs +++ b/osu.Game/Skinning/LegacySkin.cs @@ -509,7 +509,7 @@ namespace osu.Game.Skinning /// /// A sample wrapper which keeps a reference to the contained skin to avoid finalizer garbage collection of the managing SampleStore. /// - private class LegacySkinSample : ISample + private class LegacySkinSample : ISample, IDisposable { private readonly Sample sample; @@ -575,6 +575,8 @@ namespace osu.Game.Skinning public IBindable AggregateFrequency => sample.AggregateFrequency; public IBindable AggregateTempo => sample.AggregateTempo; + + public void Dispose() => sample.Dispose(); } } } diff --git a/osu.Game/Skinning/PoolableSkinnableSample.cs b/osu.Game/Skinning/PoolableSkinnableSample.cs index c01a6d20cc..b04158a58f 100644 --- a/osu.Game/Skinning/PoolableSkinnableSample.cs +++ b/osu.Game/Skinning/PoolableSkinnableSample.cs @@ -83,14 +83,6 @@ namespace osu.Game.Skinning 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(); Sample = null;