fix: Remove all callbacks when destroyed

This commit is contained in:
MoonDroid
2025-06-13 09:45:36 +07:00
parent 1b1d0a978d
commit ea0e4ee56d
@@ -94,6 +94,7 @@ class FunkinBackButton extends FunkinButton
{
FlxTween.cancelTweensOf(this);
HapticUtil.vibrate(0, 0.01, 0.2);
animation.play('idle');
FlxTween.tween(this, {alpha: restingOpacity}, 0.5, {ease: FlxEase.expoOut});
}
@@ -106,4 +107,11 @@ class FunkinBackButton extends FunkinButton
if (FlxG.android.justReleased.BACK) onDown.dispatch();
#end
}
override function destroy():Void
{
super.destroy();
onConfirmEnd.removeAll();
if (animation != null && animation.onFinish != null) animation.onFinish.removeAll();
}
}