Random crash on removeFromParentAndCleanup

Random crash on removeFromParentAndCleanup
0

I have a problem!

I have a ScrollView with nested layouts, buttons, and other scrolls.

When I trying to delete from scene this ScrollView (verticalScroll->removeFromParentAndCleanup(true):wink: time-to-time I have random crash inside renderer code or inside this fuction (void Node::visit(Renderer* renderer, const Mat4 &parentTransform, uint32_t parentFlags)) when it’s trying to iterate _children.

Even when deleting from the scene was successful and I try to create new ScrollView with nested objects it is not rendering on the scene anymore.

I am using cocos2d-x-3.17.1

Please Help!

Small Update: Deleting and regenerating starting on CallBack from an external library. I made code for testing what do the same by a button click and it works fine.

One posible soluttion is to rise flag in callback for regenerate UI elements and check it on scene update and call code for regenerating UI on the update

I think that you should show us specific code so we can see if there is a problem.