From 70d979b27b48fd5f3c8b37a07196275ed74d9c70 Mon Sep 17 00:00:00 2001 From: Erik Onarheim Date: Fri, 22 Nov 2024 21:11:44 -0600 Subject: [PATCH] fix: Particle instance leak if ParticleEmitter killed during emission --- src/engine/Particles/Particles.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/engine/Particles/Particles.ts b/src/engine/Particles/Particles.ts index 53fdc36cd..1e57146f6 100644 --- a/src/engine/Particles/Particles.ts +++ b/src/engine/Particles/Particles.ts @@ -124,9 +124,11 @@ export class Particle extends Entity { } } - public kill() { - if (this._emitter) { + public override kill() { + if (this._emitter?.active) { this._emitter.removeParticle(this); + } else { + super.kill(); } }