Skip to content

Commit

Permalink
remove all callbacks on load + destroy
Browse files Browse the repository at this point in the history
  • Loading branch information
DetectiveBaldi committed Jan 11, 2025
1 parent 1239f3f commit 2d78ec5
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions flixel/sound/FlxSound.hx
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,9 @@ class FlxSound extends FlxBasic
*/
function reset():Void
{
if (onFinish == null)
onFinish = new FlxSignal();

destroy();

x = 0;
Expand All @@ -251,9 +254,6 @@ class FlxSound extends FlxBasic
amplitudeLeft = 0;
amplitudeRight = 0;
autoDestroy = false;

if (onFinish == null)
onFinish = new FlxSignal();

if (_transform == null)
_transform = new SoundTransform();
Expand Down Expand Up @@ -287,6 +287,8 @@ class FlxSound extends FlxBasic
_sound = null;
}

onFinish.removeAll();

onComplete = null;

super.destroy();
Expand Down Expand Up @@ -449,6 +451,7 @@ class FlxSound extends FlxBasic
autoDestroy = AutoDestroy;
updateTransform();
exists = true;
onFinish.removeAll();
onFinish.add(onComplete);
onComplete = OnComplete;
#if FLX_PITCH
Expand Down

0 comments on commit 2d78ec5

Please sign in to comment.