Skip to content

Commit 649adb5

Browse files
committed
When a TextureSource is destroyed if it's got a canvas texture it's removed from the CanvasPool.
1 parent dd954de commit 649adb5

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/textures/TextureSource.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
55
*/
66

7+
var CanvasPool = require('../display/canvas/CanvasPool');
78
var Class = require('../utils/Class');
89
var CONST = require('../const');
910
var IsSizePowerOfTwo = require('../math/pow2/IsSizePowerOfTwo');
@@ -218,6 +219,11 @@ var TextureSource = new Class({
218219
this.renderer.deleteTexture(this.glTexture);
219220
}
220221

222+
if (this.isCanvas)
223+
{
224+
CanvasPool.remove(this.image);
225+
}
226+
221227
this.renderer = null;
222228
this.texture = null;
223229
this.image = null;

0 commit comments

Comments
 (0)