Skip to content

Commit 08e68bd

Browse files
committed
Check IsDisposed before setting flags in SampleChannelBass
1 parent 7aed7c4 commit 08e68bd

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

osu.Framework/Audio/Sample/SampleChannelBass.cs

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
22
// See the LICENCE file in the repository root for full licence text.
33

4+
using System;
45
using ManagedBass;
56
using osu.Framework.Audio.Mixing.Bass;
67
using osu.Framework.Audio.Track;
@@ -130,8 +131,10 @@ protected override void UpdateState()
130131

131132
public override void Play()
132133
{
133-
userRequestedPlay = true;
134+
// Check if this channel is disposed first to not set enqueuedPlaybackStart to true, which also sets Playing to true.
135+
ObjectDisposedException.ThrowIf(IsDisposed, this);
134136

137+
userRequestedPlay = true;
135138
userRequestedStop = false;
136139

137140
// 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()
152155
public override void Stop()
153156
{
154157
userRequestedPlay = false;
155-
156158
userRequestedStop = true;
157159

158160
base.Stop();

0 commit comments

Comments
 (0)