【bug提交】发现一个引擎bug,呼叫版主

cocos2dx 版本 2.2.6

在button 回调时间里面 读取CCDictionary里面的值会崩溃

有没有其他人遇到 解决方案是什么 忘告知

贴点代码喽!!让大家分析分析!

如何重现?给出重现代码。

我自己试了下,是没有问题的。请确认下是否是自己代码有问题,或者你可把你的代码贴出来:7::7:

bool HelloWorld::init()
{
//////////////////////////////
// 1. super init first
if ( !CCLayer::init() )
{
return false;
}

CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize();
CCPoint origin = CCDirector::sharedDirector()->getVisibleOrigin();

/////////////////////////////
// 2. add a menu item with "X" image, which is clicked to quit the program
//    you may modify it.

// add a "close" icon to exit the progress. it's an autorelease object
CCMenuItemImage *pCloseItem = CCMenuItemImage::create(
                                    "CloseNormal.png",
                                    "CloseSelected.png",
                                    this,
                                    menu_selector(HelloWorld::menuCloseCallback));

pCloseItem->setPosition(ccp(origin.x + visibleSize.width - pCloseItem->getContentSize().width/2 ,
                            origin.y + pCloseItem->getContentSize().height/2));

// create menu, it's an autorelease object
CCMenu* pMenu = CCMenu::create(pCloseItem, NULL);
pMenu->setPosition(CCPointZero);
this->addChild(pMenu, 1);



CCSprite *sprite = CCSprite::create();

dictionary = CCDictionary::create();
dictionary->setObject(sprite, "sprite");
return true;

}

void HelloWorld::menuCloseCallback(CCObject* pSender)
{
dictionary->objectForKey(“sprite”);
}

请两位版主大人看看 就最后一段

@@@@@@@@@@@@

@@@@@@@@@@@

没人么 就是点击了按钮 回调函数响应的就崩鸟

大哥,sprite貌似被释放掉了,你retain一下再试试崩不崩?

哎哟,dictionary也被释放掉了,你这个基本概念都没搞懂就敢揪BUG:901:

谢谢 怎么删帖 把帖子删了吧

->retain()

有自信!:)

你这sprite压根就没加载,你在逗我么。。

:11: :11: 错漏百出