Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Containers' children not removed from (in fact added to) updateList when destroyed #5818

Closed
prakol16 opened this issue Aug 26, 2021 · 1 comment

Comments

@prakol16
Copy link

prakol16 commented Aug 26, 2021

Version

  • Phaser Version: 3.55.2
  • Operating system: Ubuntu
  • Browser: any

Description

The issue is that during the removeHandler, an exclusive container adds the gameobject (which uses preUpdate, say a sprite) back to the display list, causing it to be added to the update list; then the destroy finishes, and it is removed from the update list. But the update list does not process additions and deletions immediately; instead, it now has the object in both _pending and _destroy. The end result of this is that it ends up being added to the update list, even if it wasn't originally, when the object is destroyed from within a container.

Example Test Code

I'm using the same code as the previous issue (#5817) for convenience: https://codepen.io/prakol16/pen/YzQXxpg. Note that there, because of the bug, the sprite is never added to the update list while it is alive. However, as soon as it is destroyed, it is added to the update list because of this bug, even though it wasn't on the updateList to begin with. Note that V3 in that issue, which causes the sprite to be added to the update list, is caused by the exact same issue as this bug (adding to both _pending and _destroy). It's just that there, we wanted the sprite to be in the update list, so this bug masks that bug.

photonstorm added a commit that referenced this issue Jun 7, 2022
… in the same frame were not correctly removed from the UpdateList. Fix #5803 #5817 #5818 #6052

* `ProcessQueue.isActive` is a new method that tests if the given object is in the active list, or not.
* `ProcessQueue.isPending` is a new method that tests if the given object is in the pending insertion list, or not.
* `ProcessQueue.isDestroying` is a new method that tests if the given object is pending destruction, or not.
* `ProcessQueue.add` will no longer place the item into the pending list if it's already active or pending.
* `ProcessQueue.remove` will check if the item is in the pending list, and simply remove it, rather than destroying it.
@photonstorm
Copy link
Collaborator

Thank you for submitting this issue. We have fixed this and the fix has been pushed to the master branch. It will be part of the next release. If you get time to build and test it for yourself we would appreciate that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants