UI Transform _sortSiblings Exception when Destroying UI Node
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
Could you please provide a demo to reproduce it? Thanks.
Close it as not response.