We are migrating issue tracker of Cocos2d-x Project to Github, please create new issue there. Thanks.
CCTargetedAction executes callback twice
CCTargetedAction executes callback twice
Bug #3264 [Closed]
Redmine issue system is closed, we are using github issue system instead.
This issue was moved to https://github.com/cocos2d/cocos2d-x/issues/8262
Status: | Closed | |
---|---|---|
Start date: | 2013-11-22 | |
Priority: | Low | |
Due date: | ||
Assignee: | - | |
% Done: | 0% |
|
Category: | all | |
Target version: | - |
CCLayer::init() {
…
CCSprite* r = CCSprite::create(“xxx”);
this~~>addChild;
CCSprite* e = CCSprite::create;
this~~>runAction(CCTargetedAction::create(e, CCCallFuncN::create(r, callfuncN_selector(CCSprite::addChild)))); // CCSprite::addChild will be called twice
e->runAction(CCCallFuncN::create(r, callfuncN_selector(CCSprite::addChild))); // ok
}
CCTargetedAction will make “r->addChild(e)” called twice, then CCAssert will fail.
refer: http://cocos2d-x.org/forums/6/topics/39546