cocosbuilder can't release cclayer create by ccbi files

hi all,

i create custom layer by ccbi

……

CCNode ***nodeLayer =ccbReaderLayer->readNodeGraphFromFile;
MainMenu
**menuLayer = static_cast<MainMenu >;
……
CCScene *scene = CCScene::create;
scene->addChild;
CCDirector::sharedDirector->replaceScene;
it’s ok by now
when i replace this scene by another, just like game scene, the MainMenu\ func\ can\ not\ be\ called.
and\ i\ found\ the\ code\
\ if\ )
\ {
\ mActionManager->setRootNode;
\ }
CCBReader.cpp\ line\ 558
“node”\ is\ the\ instance\ of\ “MainMenu”,\ and\ i\ change\ the\ code\ setRootNode\ like\ this\
void\ CCBAnimationManager::setRootNode
{
//\ CC_SAFE_RELEASE;
\ mRootNode\ =\ pRootNode;
//\ CC_SAFE_RETAIN;
}
MainMenu func be called correctly.
so i guess
menuLayer has the reference of the mActionManager, and mActionManager has the reference of _menuLayer.

so you can not release any of them in fact.

i want to know if it is reason i can’t release the custom cclayer?

or i need to add some code to release them ?

thx.

I came cross this issue whenever I load a node from ccbi file;
The rootNode will call setUserObject(mActionManager) which will retain mActionManager;
So it’s an obviously cycle reference issue;