From 83ea9e5e2c8d2a30dae23a3bcd09778e0d4b1311 Mon Sep 17 00:00:00 2001 From: James Chen Date: Wed, 23 Jan 2013 15:14:40 +0800 Subject: [PATCH] fixed #1670: fixed retain interaction. Only CCNode should retain CCAnimationManager, CCAnimationManger shouldn't retain CCNode. --- extensions/CCBReader/CCBAnimationManager.cpp | 17 +++++++++-------- extensions/CCBReader/CCBReader.cpp | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/extensions/CCBReader/CCBAnimationManager.cpp b/extensions/CCBReader/CCBAnimationManager.cpp index bad887e49c..83ab0e1aeb 100644 --- a/extensions/CCBReader/CCBAnimationManager.cpp +++ b/extensions/CCBReader/CCBAnimationManager.cpp @@ -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(); } } diff --git a/extensions/CCBReader/CCBReader.cpp b/extensions/CCBReader/CCBReader.cpp index 38a590bd0e..c3a27b0eeb 100644 --- a/extensions/CCBReader/CCBReader.cpp +++ b/extensions/CCBReader/CCBReader.cpp @@ -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) {