From ed023fc129b8fdd3f65eb848c25d84c018431251 Mon Sep 17 00:00:00 2001 From: Ming Date: Wed, 1 Sep 2010 07:36:25 +0000 Subject: [PATCH] fixed #112 --- cocos2dx/CCDirector.cpp | 2 +- cocos2dx/actions/CCEaseAction.cpp | 52 ++++++++++---------- cocos2dx/actions/CCGrid3DAction.cpp | 18 +++---- cocos2dx/actions/CCPageTurn3DAction.cpp | 2 +- cocos2dx/actions/CCTiledGridAction.cpp | 24 ++++----- cocos2dx/misc_nodes/CCProgressTimer.cpp | 21 ++++---- cocos2dx/sprite_nodes/CCSpriteFrameCache.cpp | 2 +- 7 files changed, 61 insertions(+), 60 deletions(-) diff --git a/cocos2dx/CCDirector.cpp b/cocos2dx/CCDirector.cpp index d0a79e6b00..76f2d718b7 100644 --- a/cocos2dx/CCDirector.cpp +++ b/cocos2dx/CCDirector.cpp @@ -604,7 +604,7 @@ void CCDirector::end(void) stopAnimation(); #if CC_DIRECTOR_FAST_FPS - CCX_SAFE_RELEASE(m_pFPSLabel); + CCX_SAFE_RELEASE_NULL(m_pFPSLabel); #endif // purge bitmap cache diff --git a/cocos2dx/actions/CCEaseAction.cpp b/cocos2dx/actions/CCEaseAction.cpp index 8f11276c37..2c673a8ab3 100644 --- a/cocos2dx/actions/CCEaseAction.cpp +++ b/cocos2dx/actions/CCEaseAction.cpp @@ -51,7 +51,7 @@ namespace cocos2d { } else { - CCX_SAFE_RELEASE(pRet); + CCX_SAFE_RELEASE_NULL(pRet); } } @@ -137,7 +137,7 @@ namespace cocos2d { } else { - CCX_SAFE_RELEASE(pRet); + CCX_SAFE_RELEASE_NULL(pRet); } } @@ -203,7 +203,7 @@ namespace cocos2d { } else { - CCX_SAFE_RELEASE(pRet); + CCX_SAFE_RELEASE_NULL(pRet); } } @@ -254,7 +254,7 @@ namespace cocos2d { } else { - CCX_SAFE_RELEASE(pRet); + CCX_SAFE_RELEASE_NULL(pRet); } } @@ -305,7 +305,7 @@ namespace cocos2d { } else { - CCX_SAFE_RELEASE(pRet); + CCX_SAFE_RELEASE_NULL(pRet); } } @@ -377,7 +377,7 @@ namespace cocos2d { } else { - CCX_SAFE_RELEASE(pRet); + CCX_SAFE_RELEASE_NULL(pRet); } } @@ -432,7 +432,7 @@ namespace cocos2d { } else { - CCX_SAFE_RELEASE(pRet); + CCX_SAFE_RELEASE_NULL(pRet); } } @@ -487,7 +487,7 @@ namespace cocos2d { } else { - CCX_SAFE_RELEASE(pRet); + CCX_SAFE_RELEASE_NULL(pRet); } } @@ -547,7 +547,7 @@ namespace cocos2d { } else { - CCX_SAFE_RELEASE(pRet); + CCX_SAFE_RELEASE_NULL(pRet); } } @@ -602,7 +602,7 @@ namespace cocos2d { } else { - CCX_SAFE_RELEASE(pRet); + CCX_SAFE_RELEASE_NULL(pRet); } } @@ -657,7 +657,7 @@ namespace cocos2d { } else { - CCX_SAFE_RELEASE(pRet); + CCX_SAFE_RELEASE_NULL(pRet); } } @@ -707,7 +707,7 @@ namespace cocos2d { } else { - CCX_SAFE_RELEASE(pRet); + CCX_SAFE_RELEASE_NULL(pRet); } } @@ -725,7 +725,7 @@ namespace cocos2d { } else { - CCX_SAFE_RELEASE(pRet); + CCX_SAFE_RELEASE_NULL(pRet); } } @@ -793,7 +793,7 @@ namespace cocos2d { } else { - CCX_SAFE_RELEASE(pRet); + CCX_SAFE_RELEASE_NULL(pRet); } } @@ -811,7 +811,7 @@ namespace cocos2d { } else { - CCX_SAFE_RELEASE(pRet); + CCX_SAFE_RELEASE_NULL(pRet); } } @@ -878,7 +878,7 @@ namespace cocos2d { } else { - CCX_SAFE_RELEASE(pRet); + CCX_SAFE_RELEASE_NULL(pRet); } } @@ -896,7 +896,7 @@ namespace cocos2d { } else { - CCX_SAFE_RELEASE(pRet); + CCX_SAFE_RELEASE_NULL(pRet); } } @@ -962,7 +962,7 @@ namespace cocos2d { } else { - CCX_SAFE_RELEASE(pRet); + CCX_SAFE_RELEASE_NULL(pRet); } } @@ -980,7 +980,7 @@ namespace cocos2d { } else { - CCX_SAFE_RELEASE(pRet); + CCX_SAFE_RELEASE_NULL(pRet); } } @@ -1062,7 +1062,7 @@ namespace cocos2d { } else { - CCX_SAFE_RELEASE(pRet); + CCX_SAFE_RELEASE_NULL(pRet); } } @@ -1128,7 +1128,7 @@ namespace cocos2d { } else { - CCX_SAFE_RELEASE(pRet); + CCX_SAFE_RELEASE_NULL(pRet); } } @@ -1184,7 +1184,7 @@ namespace cocos2d { } else { - CCX_SAFE_RELEASE(pRet); + CCX_SAFE_RELEASE_NULL(pRet); } } @@ -1240,7 +1240,7 @@ namespace cocos2d { } else { - CCX_SAFE_RELEASE(pRet); + CCX_SAFE_RELEASE_NULL(pRet); } } @@ -1301,7 +1301,7 @@ namespace cocos2d { } else { - CCX_SAFE_RELEASE(pRet); + CCX_SAFE_RELEASE_NULL(pRet); } } @@ -1357,7 +1357,7 @@ namespace cocos2d { } else { - CCX_SAFE_RELEASE(pRet); + CCX_SAFE_RELEASE_NULL(pRet); } } @@ -1415,7 +1415,7 @@ namespace cocos2d { } else { - CCX_SAFE_RELEASE(pRet); + CCX_SAFE_RELEASE_NULL(pRet); } } diff --git a/cocos2dx/actions/CCGrid3DAction.cpp b/cocos2dx/actions/CCGrid3DAction.cpp index f68330e7ad..dc8116768e 100644 --- a/cocos2dx/actions/CCGrid3DAction.cpp +++ b/cocos2dx/actions/CCGrid3DAction.cpp @@ -40,7 +40,7 @@ namespace cocos2d } else { - CCX_SAFE_RELEASE(pAction); + CCX_SAFE_RELEASE_NULL(pAction); } } @@ -114,7 +114,7 @@ namespace cocos2d } else { - CCX_SAFE_RELEASE(pAction); + CCX_SAFE_RELEASE_NULL(pAction); } } @@ -240,7 +240,7 @@ namespace cocos2d } else { - CCX_SAFE_RELEASE(pAction); + CCX_SAFE_RELEASE_NULL(pAction); } } @@ -349,7 +349,7 @@ namespace cocos2d } else { - CCX_SAFE_RELEASE(pAction); + CCX_SAFE_RELEASE_NULL(pAction); } } @@ -451,7 +451,7 @@ namespace cocos2d } else { - CCX_SAFE_RELEASE(pAction); + CCX_SAFE_RELEASE_NULL(pAction); } } @@ -536,7 +536,7 @@ namespace cocos2d } else { - CCX_SAFE_RELEASE(pAction); + CCX_SAFE_RELEASE_NULL(pAction); } } @@ -614,7 +614,7 @@ namespace cocos2d } else { - CCX_SAFE_RELEASE(pAction); + CCX_SAFE_RELEASE_NULL(pAction); } } @@ -688,7 +688,7 @@ namespace cocos2d } else { - CCX_SAFE_RELEASE(pAction); + CCX_SAFE_RELEASE_NULL(pAction); } } @@ -773,7 +773,7 @@ namespace cocos2d } else { - CCX_SAFE_RELEASE(pAction); + CCX_SAFE_RELEASE_NULL(pAction); } } diff --git a/cocos2dx/actions/CCPageTurn3DAction.cpp b/cocos2dx/actions/CCPageTurn3DAction.cpp index f30659243f..dad9ad8377 100644 --- a/cocos2dx/actions/CCPageTurn3DAction.cpp +++ b/cocos2dx/actions/CCPageTurn3DAction.cpp @@ -37,7 +37,7 @@ namespace cocos2d } else { - CCX_SAFE_RELEASE(pAction); + CCX_SAFE_RELEASE_NULL(pAction); } } diff --git a/cocos2dx/actions/CCTiledGridAction.cpp b/cocos2dx/actions/CCTiledGridAction.cpp index 434ba984cd..d561256294 100644 --- a/cocos2dx/actions/CCTiledGridAction.cpp +++ b/cocos2dx/actions/CCTiledGridAction.cpp @@ -50,7 +50,7 @@ namespace cocos2d } else { - CCX_SAFE_RELEASE(pAction); + CCX_SAFE_RELEASE_NULL(pAction); } } @@ -143,7 +143,7 @@ namespace cocos2d } else { - CCX_SAFE_RELEASE(pAction); + CCX_SAFE_RELEASE_NULL(pAction); } } @@ -241,7 +241,7 @@ namespace cocos2d } else { - CCX_SAFE_RELEASE(pAction); + CCX_SAFE_RELEASE_NULL(pAction); } } @@ -407,7 +407,7 @@ namespace cocos2d } else { - CCX_SAFE_RELEASE(pAction); + CCX_SAFE_RELEASE_NULL(pAction); } } @@ -495,7 +495,7 @@ namespace cocos2d } else { - CCX_SAFE_RELEASE(pAction); + CCX_SAFE_RELEASE_NULL(pAction); } } @@ -527,7 +527,7 @@ namespace cocos2d } else { - CCX_SAFE_RELEASE(pAction); + CCX_SAFE_RELEASE_NULL(pAction); } } @@ -571,7 +571,7 @@ namespace cocos2d } else { - CCX_SAFE_RELEASE(pAction); + CCX_SAFE_RELEASE_NULL(pAction); } } @@ -616,7 +616,7 @@ namespace cocos2d } else { - CCX_SAFE_RELEASE(pAction); + CCX_SAFE_RELEASE_NULL(pAction); } } @@ -749,7 +749,7 @@ namespace cocos2d } else { - CCX_SAFE_RELEASE(pAction); + CCX_SAFE_RELEASE_NULL(pAction); } } @@ -827,7 +827,7 @@ namespace cocos2d } else { - CCX_SAFE_RELEASE(pAction); + CCX_SAFE_RELEASE_NULL(pAction); } } @@ -916,7 +916,7 @@ namespace cocos2d } else { - CCX_SAFE_RELEASE(pAction); + CCX_SAFE_RELEASE_NULL(pAction); } } @@ -995,7 +995,7 @@ namespace cocos2d } else { - CCX_SAFE_RELEASE(pAction); + CCX_SAFE_RELEASE_NULL(pAction); } } diff --git a/cocos2dx/misc_nodes/CCProgressTimer.cpp b/cocos2dx/misc_nodes/CCProgressTimer.cpp index d8d53356d3..550f3f37be 100644 --- a/cocos2dx/misc_nodes/CCProgressTimer.cpp +++ b/cocos2dx/misc_nodes/CCProgressTimer.cpp @@ -120,17 +120,18 @@ namespace cocos2d if (m_pSprite != pSprite) { CCX_SAFE_RELEASE(m_pSprite); - } - m_pSprite = pSprite; - pSprite->retain(); - // Everytime we set a new sprite, we free the current vertex data - if (m_pVertexData) - { - delete[] m_pVertexData; - m_pVertexData = NULL; - m_nVertexDataCount = 0; - } + m_pSprite = pSprite; + pSprite->retain(); + + // Everytime we set a new sprite, we free the current vertex data + if (m_pVertexData) + { + delete[] m_pVertexData; + m_pVertexData = NULL; + m_nVertexDataCount = 0; + } + } } void CCProgressTimer::setType(cocos2d::CCProgressTimerType type) diff --git a/cocos2dx/sprite_nodes/CCSpriteFrameCache.cpp b/cocos2dx/sprite_nodes/CCSpriteFrameCache.cpp index 15083f28af..3b66f141be 100644 --- a/cocos2dx/sprite_nodes/CCSpriteFrameCache.cpp +++ b/cocos2dx/sprite_nodes/CCSpriteFrameCache.cpp @@ -49,7 +49,7 @@ CCSpriteFrameCache* CCSpriteFrameCache::sharedSpriteFrameCache(void) void CCSpriteFrameCache::purgeSharedSpriteFrameCache(void) { - CCX_SAFE_RELEASE(pSharedSpriteFrameCache); + CCX_SAFE_RELEASE_NULL(pSharedSpriteFrameCache); } CCSpriteFrameCache* CCSpriteFrameCache::init(void)