Merge pull request #4646 from rexrainbow/master

Remove event hook of children when destroyChildren is false
This commit is contained in:
Richard Davey 2019-07-11 11:48:14 +01:00 committed by GitHub
commit 9dcff3b0fb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1134,22 +1134,7 @@ var Group = new Class({
return;
}
if (destroyChildren)
{
var children = this.children;
for (var i = 0; i < children.size; i++)
{
var gameObject = children.entries[i];
// Remove the event hook first or it'll go all recursive hell on us
gameObject.off(Events.DESTROY, this.remove, this);
gameObject.destroy();
}
}
this.children.clear();
this.clear(false, destroyChildren);
this.scene = undefined;
this.children = undefined;