Skip to content

Commit

Permalink
Check IsDisposed before setting flags in SampleChannelBass
Browse files Browse the repository at this point in the history
  • Loading branch information
hwsmm committed Oct 25, 2024
1 parent 7aed7c4 commit 08e68bd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions osu.Framework/Audio/Sample/SampleChannelBass.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd <[email protected]>. 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;
Expand Down Expand Up @@ -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.
Expand All @@ -152,7 +155,6 @@ public override void Play()
public override void Stop()
{
userRequestedPlay = false;

userRequestedStop = true;

base.Stop();
Expand Down

0 comments on commit 08e68bd

Please sign in to comment.