From 08e68bde3a3745233370bc09509058b5dfc61b44 Mon Sep 17 00:00:00 2001 From: hwsmm <9151706+hwsmm@users.noreply.github.com> Date: Fri, 25 Oct 2024 21:27:03 +0900 Subject: [PATCH] Check IsDisposed before setting flags in SampleChannelBass --- osu.Framework/Audio/Sample/SampleChannelBass.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/osu.Framework/Audio/Sample/SampleChannelBass.cs b/osu.Framework/Audio/Sample/SampleChannelBass.cs index b57cba7dc6..8cd5f46a20 100644 --- a/osu.Framework/Audio/Sample/SampleChannelBass.cs +++ b/osu.Framework/Audio/Sample/SampleChannelBass.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using ManagedBass; using osu.Framework.Audio.Mixing.Bass; using osu.Framework.Audio.Track; @@ -130,8 +131,10 @@ protected override void UpdateState() public override void Play() { - userRequestedPlay = true; + // Check if this channel is disposed first to not set enqueuedPlaybackStart to true, which also sets Playing to true. + ObjectDisposedException.ThrowIf(IsDisposed, this); + userRequestedPlay = true; userRequestedStop = false; // Pin Playing and IsAlive to true so that the channel isn't killed by the next update. This is only reset after playback is started. @@ -152,7 +155,6 @@ public override void Play() public override void Stop() { userRequestedPlay = false; - userRequestedStop = true; base.Stop();