From 113f1ab2effc3220ceb170feb3d39335874f930c Mon Sep 17 00:00:00 2001 From: minggo Date: Fri, 6 May 2011 18:09:31 +0800 Subject: [PATCH] fixed #484: solve a potential issue --- cocos2dx/textures/CCTextureAtlas.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cocos2dx/textures/CCTextureAtlas.cpp b/cocos2dx/textures/CCTextureAtlas.cpp index 9a1a641cdd..a0a75a7daa 100644 --- a/cocos2dx/textures/CCTextureAtlas.cpp +++ b/cocos2dx/textures/CCTextureAtlas.cpp @@ -152,6 +152,10 @@ bool CCTextureAtlas::initWithTexture(CCTexture2D *texture, unsigned int capacity //CCLOG("cocos2d: CCTextureAtlas: not enough memory"); CC_SAFE_FREE(m_pQuads) CC_SAFE_FREE(m_pIndices) + + // release texture, should set it to null, because the destruction will + // release it too. see cocos2d-x issue #484 + CC_SAFE_RELEASE_NULL(m_pTexture); return false; }