Fix resource leaks discovered while testing

- `Drawable` now removes its `Skin` on `dispose`, disconnecting events.
- Creating a new `Drawable` doesn't always create a new `Skin` any more:
  now it can share an existing skin.
- Don't throw when asked to update the properties of a `Drawable` that
  has already been destroyed. This seems like a VM bug but was causing
  overwhelming output in the browser for some projects.
This commit is contained in:
Christopher Willis-Ford 2016-12-29 13:42:58 -08:00
parent 6643469ff2
commit 1f0cd4b61f
4 changed files with 31 additions and 10 deletions

View file

@ -69,9 +69,8 @@ class Drawable {
* Dispose of this Drawable. Do not use it after calling this method.
*/
dispose () {
if (this._id >= 0) {
delete Drawable[this._id];
}
// Use the setter: disconnect events
this.skin = null;
}
/**