gree / lwf

LWF - Lightweight SWF
http://gree.github.com/lwf/
zlib License
627 stars 167 forks source link

cocos2dx: LWFNode crush when removeFromParent from event handler #85

Closed oleg-akatsuki closed 10 years ago

oleg-akatsuki commented 10 years ago

LWFNode will crush if try to do removeFromParentAndCleanup(true) from event handler body, so it is very difficult to release objects dynamically in action game.

Example

lwf->AddEventHandler("done", [=](LWF::Movie *movie, LWF::Button *){
    this->removeFromParentAndCleanup(true);
    });
splhack commented 10 years ago

LWF doesn't support the way to delete LWF instance. You can release objects in other way.

splhack commented 10 years ago

Ok, it's a common issue now. We updated LWF to avoid the crash. Please try to use LWFNode::requestRemoveFromParent API.

lwf->AddEventHandler("done", [=](LWF::Movie *movie, LWF::Button *){
    this->requestRemoveFromParent();
});