Skip to content

Commit ac3fac4

Browse files
committed
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 phaserjs#4365
1 parent 11c1b45 commit ac3fac4

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ Notes:
168168
* 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)
169169
* `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)
170170
* `Phaser.Physics.Arcade.Events` is now exposed in the namespace, preventing it from erroring if you use them in TypeScript. Fix #4481 (thanks @danielalves)
171+
* `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)
171172

172173
### Examples, Documentation and TypeScript
173174

src/gameobjects/UpdateList.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,11 +216,11 @@ var UpdateList = new Class({
216216
*/
217217
remove: function (child)
218218
{
219-
var index = this._list.indexOf(child);
219+
var index = this._pendingRemoval.indexOf(child);
220220

221221
if (index !== -1)
222222
{
223-
this._list.splice(index, 1);
223+
this._pendingRemoval.push(child);
224224
}
225225

226226
return child;

0 commit comments

Comments
 (0)