fixed #1670: fixed retain interaction. Only CCNode should retain CCAnimationManager, CCAnimationManger shouldn't retain CCNode.

This commit is contained in:
James Chen 2013-01-23 15:14:40 +08:00
parent b5efd699bf
commit 83ea9e5e2c
2 changed files with 10 additions and 9 deletions

View File

@ -50,13 +50,13 @@ CCBAnimationManager::~CCBAnimationManager()
CCDICT_FOREACH(mNodeSequences, pElement)
{
CCNode *node = (CCNode*)pElement->getIntKey();
node->release();
// node->release();
}
CCDICT_FOREACH(mBaseValues, pElement)
{
CCNode *node = (CCNode*)pElement->getIntKey();
node->release();
// node->release();
}
mNodeSequences->release();
@ -70,6 +70,7 @@ CCBAnimationManager::~CCBAnimationManager()
CC_SAFE_RELEASE(mDocumentCallbackNames);
CC_SAFE_RELEASE(mDocumentCallbackNodes);
CC_SAFE_RELEASE(mTarget);
}
CCArray* CCBAnimationManager::getSequences()
@ -190,7 +191,7 @@ const CCSize& CCBAnimationManager::getContainerSize(CCNode *pNode)
// refer to CCBReader::readNodeGraph() for data structure of pSeq
void CCBAnimationManager::addNode(CCNode *pNode, CCDictionary *pSeq)
{
pNode->retain();
// pNode->retain();
mNodeSequences->setObject(pSeq, (intptr_t)pNode);
}
@ -202,7 +203,7 @@ void CCBAnimationManager::setBaseValue(CCObject *pValue, CCNode *pNode, const ch
{
props = CCDictionary::create();
mBaseValues->setObject(props, (intptr_t)pNode);
pNode->retain();
// pNode->retain();
}
props->setObject(pValue, pPropName);
@ -253,8 +254,8 @@ void CCBAnimationManager::moveAnimationsFromNode(CCNode* fromNode, CCNode* toNod
mBaseValues->setObject(baseValue, (intptr_t)toNode);
mBaseValues->removeObjectForKey((intptr_t)fromNode);
fromNode->release();
toNode->retain();
// fromNode->release();
// toNode->retain();
}
// Move seqs
@ -263,8 +264,8 @@ void CCBAnimationManager::moveAnimationsFromNode(CCNode* fromNode, CCNode* toNod
mNodeSequences->setObject(seqs, (intptr_t)toNode);
mNodeSequences->removeObjectForKey((intptr_t)fromNode);
fromNode->release();
toNode->retain();
// fromNode->release();
// toNode->retain();
}
}

View File

@ -294,7 +294,7 @@ CCNode* CCBReader::readNodeGraphFromData(CCData *pData, CCObject *pOwner, const
{
CCNode* pNode = (CCNode*)pElement->getIntKey();
CCBAnimationManager* manager = (CCBAnimationManager*)animationManagers->objectForKey((intptr_t)pNode);
//pNode->setUserObject(manager);
pNode->setUserObject(manager);
if (jsControlled)
{