mirror of
https://github.com/scratchfoundation/scratch-render.git
synced 2025-08-28 22:30:04 -04:00
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:
parent
6643469ff2
commit
1f0cd4b61f
4 changed files with 31 additions and 10 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue