mirror of
https://github.com/photonstorm/phaser
synced 2024-09-20 14:31:55 +00:00
AnimationManager.destroy now iterates through child animations calling destroy on all of them, avoiding a memory leak (thanks stauzs)
Animation.destroy didn't correctly clear the onStart, onLoop and onComplete signals.
This commit is contained in:
parent
a7f6165e39
commit
5d0ea6453b
3 changed files with 18 additions and 4 deletions
|
@ -62,6 +62,7 @@ Version 2.0.4 - "Mos Shirare" - in development
|
|||
* TypeScript definitions fixes and updates (thanks @clark-stevenson)
|
||||
* Timer has removed all use of local temporary vars in the core update loop.
|
||||
* The Input.reset `hard` reset parameter is now passed down to the Keyboard and Key reset methods.
|
||||
* AnimationManager.destroy now iterates through child animations calling destroy on all of them, avoiding a memory leak (thanks stauzs)
|
||||
|
||||
|
||||
### New Features
|
||||
|
@ -80,6 +81,8 @@ Version 2.0.4 - "Mos Shirare" - in development
|
|||
* The main Timer loop could incorrectly remove TimeEvent if a new one was added specifically during an event callback (thanks @garyyeap, fix #710)
|
||||
* Fixed the use of the destroy parameter in Group.removeAll and related functions (thanks @AnderbergE, fix #717)
|
||||
* P2.World.convertTilemap now correctly checks the collides parameter of the tiles as it converts them.
|
||||
* Animation.destroy didn't correctly clear the onStart, onLoop and onComplete signals.
|
||||
|
||||
|
||||
|
||||
There is an extensive [Migration Guide](https://github.com/photonstorm/phaser/blob/master/resources/Migration%20Guide.md) available for those converting from Phaser 1.x to 2.x. In the guide we detail the API breaking changes and approach to our new physics system.
|
||||
|
|
|
@ -386,9 +386,9 @@ Phaser.Animation.prototype = {
|
|||
this.currentFrame = null;
|
||||
this.isPlaying = false;
|
||||
|
||||
this.onStart.destroy();
|
||||
this.onLoop.destroy();
|
||||
this.onComplete.destroy();
|
||||
this.onStart.dispose();
|
||||
this.onLoop.dispose();
|
||||
this.onComplete.dispose();
|
||||
|
||||
this.game.onPause.remove(this.onPause, this);
|
||||
this.game.onResume.remove(this.onResume, this);
|
||||
|
|
|
@ -306,12 +306,23 @@ Phaser.AnimationManager.prototype = {
|
|||
},
|
||||
|
||||
/**
|
||||
* Destroys all references this AnimationManager contains. Sets the _anims to a new object and nulls the current animation.
|
||||
* Destroys all references this AnimationManager contains.
|
||||
* Iterates through the list of animations stored in this manager and calls destroy on each of them.
|
||||
*
|
||||
* @method Phaser.AnimationManager#destroy
|
||||
*/
|
||||
destroy: function () {
|
||||
|
||||
var anim = null;
|
||||
|
||||
for (var anim in this._anims)
|
||||
{
|
||||
if (this._anims.hasOwnProperty(anim))
|
||||
{
|
||||
this._anims[anim].destroy();
|
||||
}
|
||||
}
|
||||
|
||||
this._anims = {};
|
||||
this._frameData = null;
|
||||
this._frameIndex = 0;
|
||||
|
|
Loading…
Reference in a new issue