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

UI Transform _sortSiblings Exception when Destroying UI Node #16949

Open
hulcypdiscord opened this issue May 6, 2024 · 1 comment
Open

UI Transform _sortSiblings Exception when Destroying UI Node #16949

hulcypdiscord opened this issue May 6, 2024 · 1 comment
Assignees
Labels
Milestone

Comments

@hulcypdiscord
Copy link
Contributor

Cocos Creator version

3.8.2

System information

Mac OSX 14.4.1

Issue description

I am implementing a virtual scrolling list that can handle having the scroll view resize. During resize it creates/destroys the re-usable list item elements based on the current view rect size. I trigger this in response to the view rect being resized, which triggers all child ui-transform components to register to have their children resorted at the end of the update frame. However I then destroy some of the list item elements during that same callback as they are no longer needed with the new size of the view rect. This results in UITransform.priorityChangeNodeMap having invalid/destroyed entries in it causing an unhandled exception to be thrown that results in UITransform.priorityChangeNodeMap never getting cleared because the call stack is interrupted. I 'think' the fix for this is to just have ui-transform remove itself from this list if it's onDestroy is called and/or have the sort loop check that the node is still valid.

Relevant error log output

No response

Steps to reproduce

Reproduction is a bit tricky as I think it does have something to do with the way we have some nested data contained within each list item. However it generally feels like a scenario that should be properly safe-guarded against.

Minimal reproduction project

No response

@hulcypdiscord hulcypdiscord added Bug Needs Triage Needs to be assigned by the team labels May 6, 2024
@minggo minggo self-assigned this May 8, 2024
@minggo minggo added this to the 3.8.5 milestone May 8, 2024
@minggo minggo removed the Needs Triage Needs to be assigned by the team label May 8, 2024
@minggo
Copy link
Contributor

minggo commented May 14, 2024

Could you please provide a demo to reproduce it? Thanks.

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

No branches or pull requests

2 participants