diff --git a/src/pixi/text/Text.js b/src/pixi/text/Text.js index f4d82cb..190c439 100644 --- a/src/pixi/text/Text.js +++ b/src/pixi/text/Text.js @@ -361,15 +361,11 @@ * Destroys this text object * * @method destroy - * @param destroyTexture {Boolean} + * @param destroyBaseTexture {Boolean} whether to destroy the base texture as well */ -PIXI.Text.prototype.destroy = function(destroyTexture) +PIXI.Text.prototype.destroy = function(destroyBaseTexture) { - if(destroyTexture) - { - this.texture.destroy(); - } - + this.texture.destroy(destroyBaseTexture); }; PIXI.Text.heightCache = {}; diff --git a/src/pixi/text/Text.js b/src/pixi/text/Text.js index f4d82cb..190c439 100644 --- a/src/pixi/text/Text.js +++ b/src/pixi/text/Text.js @@ -361,15 +361,11 @@ * Destroys this text object * * @method destroy - * @param destroyTexture {Boolean} + * @param destroyBaseTexture {Boolean} whether to destroy the base texture as well */ -PIXI.Text.prototype.destroy = function(destroyTexture) +PIXI.Text.prototype.destroy = function(destroyBaseTexture) { - if(destroyTexture) - { - this.texture.destroy(); - } - + this.texture.destroy(destroyBaseTexture); }; PIXI.Text.heightCache = {}; diff --git a/src/pixi/textures/BaseTexture.js b/src/pixi/textures/BaseTexture.js index d0b3ce4..e1b0291 100644 --- a/src/pixi/textures/BaseTexture.js +++ b/src/pixi/textures/BaseTexture.js @@ -118,6 +118,10 @@ this.imageUrl = null; this.source.src = null; } + else if (this.source && this.source._pixiId) + { + delete PIXI.BaseTextureCache[this.source._pixiId]; + } this.source = null; PIXI.texturesToDestroy.push(this); };