Skip to content

Commit

Permalink
UpdateList.remove will now move the removed child to the internal `…
Browse files Browse the repository at this point in the history
…_pendingRemoval` array, instead of slicing it directly out of the active list. The pending list is cleared at the start of the next game frame. Fix #4365
  • Loading branch information
photonstorm committed Apr 24, 2019
1 parent 11c1b45 commit ac3fac4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ Notes:
* Destroying a Game object during its `pointerup` event handler on a touch device will no longer cause `Uncaught TypeError: Cannot read property 'localX' of undefined`. All InputPlugin process handlers now check to see if the Game Object has been destroyed at any stage and abort if it has. Fix #4463 (thanks @PatrickSachs)
* `InputPlugin.clear` has a new argument `skipQueue` which is used to avoid clearing a Game Object twice. This, combined with the fix for 4463 means you will no longer get a `Cannot read property 'dragState'` error if you destroy a Game Object enabled for drag where another draggable object exists. Fix #4228 (thanks @YannCaron)
* `Phaser.Physics.Arcade.Events` is now exposed in the namespace, preventing it from erroring if you use them in TypeScript. Fix #4481 (thanks @danielalves)
* `UpdateList.remove` will now move the removed child to the internal `_pendingRemoval` array, instead of slicing it directly out of the active list. The pending list is cleared at the start of the next game frame. Fix #4365 (thanks @jcyuan)

### Examples, Documentation and TypeScript

Expand Down
4 changes: 2 additions & 2 deletions src/gameobjects/UpdateList.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,11 @@ var UpdateList = new Class({
*/
remove: function (child)
{
var index = this._list.indexOf(child);
var index = this._pendingRemoval.indexOf(child);

if (index !== -1)
{
this._list.splice(index, 1);
this._pendingRemoval.push(child);
}

return child;
Expand Down

0 comments on commit ac3fac4

Please sign in to comment.