GoodBoyDigital/pixi.js — pull request #413 by mattdesl (2013-11-25 18:22:40+00:00)
Title: Cleaning up BaseTexture Destroy

Just noticed that we are now [removing the Image reference](https://github.com/GoodBoyDigital/pixi.js/blob/dev_simple_batch/src/pixi/textures/BaseTexture.js#L109) from the base texture cache on destroy. This is good (we use this in our own fork, and it caused a big boost on mobile performance). But in my testing I've noticed that the "src" attribute of Image will not always return the exact string you set it earlier. For example, it may get appended with the domain (i.e. "http://localhost/"). This leads to a problem where the BaseTexture is still not deleted correctly.

This pull request adds three things:

- It fixes this issue by storing the imageURL string for later deletion.
- It does not call drawImage if the baseTexture's source is null.
- It adds removeAllEventListeners to EventTarget. This was useful in our game where we are loading and unloading textures on the fly, and relying on AssetLoader's "onComplete" event.

We are not unloading textures when WebGL is active, so that path may need some further testing.