From d9a2722f9238bc1e15ae7fb7049b0b882f3af017 Mon Sep 17 00:00:00 2001 From: Andy Skelton Date: Fri, 16 Dec 2011 13:45:05 -0600 Subject: [PATCH] fix memory leak due to rockets never being returned to spareParticles array --- js/canvas.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/js/canvas.js b/js/canvas.js index 1ecf801..d473f66 100644 --- a/js/canvas.js +++ b/js/canvas.js @@ -668,7 +668,7 @@ if ( typeof this.imgs == 'object' ) this.img = this.imgs[ i % this.imgs.length ]; } else { - this.disable(); + this.disable(true); } } }; @@ -693,8 +693,8 @@ this.y = y; }; - Particle.prototype.disable = function() { - if (this.enabled && this.expendable) { + Particle.prototype.disable = function(force) { + if (this.enabled && ( this.expendable || force ) ) { this.enabled = false; this.fireworks.spareParticles.push(this); }