From ec53d87c307f286c725fd612b2d897100c2b86af Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 16 Jun 2022 16:04:52 +0900 Subject: [PATCH] Fix unsafe sample playback in `GameplaySampleTriggerSource` Resolves https://github.com/ppy/osu/issues/18727. Added delay from `Schedule` should be minimal as it is always called from the `Update` thread (input propagation) anyway. --- osu.Game/Rulesets/UI/GameplaySampleTriggerSource.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Rulesets/UI/GameplaySampleTriggerSource.cs b/osu.Game/Rulesets/UI/GameplaySampleTriggerSource.cs index c18698f77e..6b5cdc4ddf 100644 --- a/osu.Game/Rulesets/UI/GameplaySampleTriggerSource.cs +++ b/osu.Game/Rulesets/UI/GameplaySampleTriggerSource.cs @@ -56,12 +56,12 @@ public virtual void Play() PlaySamples(samples); } - protected void PlaySamples(ISampleInfo[] samples) + protected void PlaySamples(ISampleInfo[] samples) => Schedule(() => { var hitSound = getNextSample(); hitSound.Samples = samples; hitSound.Play(); - } + }); protected HitObject GetMostValidObject() {