diff --git a/cocos2dx/particle_nodes/CCParticleSystem.cpp b/cocos2dx/particle_nodes/CCParticleSystem.cpp index e0de48bb0b..ac2d53ba22 100644 --- a/cocos2dx/particle_nodes/CCParticleSystem.cpp +++ b/cocos2dx/particle_nodes/CCParticleSystem.cpp @@ -315,6 +315,8 @@ bool CCParticleSystem::initWithDictionary(CCDictionary *dictionary) CC_BREAK_IF(!isOK); setTexture(CCTextureCache::sharedTextureCache()->addUIImage(image, fullpath.c_str())); + + image->release(); } } CCAssert( this->m_pTexture != NULL, "CCParticleSystem: error loading the texture"); diff --git a/cocos2dx/platform/CCImage.h b/cocos2dx/platform/CCImage.h index 5872ecaa03..eb4b7d49b4 100644 --- a/cocos2dx/platform/CCImage.h +++ b/cocos2dx/platform/CCImage.h @@ -25,11 +25,11 @@ THE SOFTWARE. #ifndef __CC_IMAGE_H__ #define __CC_IMAGE_H__ -#include "CCCommon.h" +#include "CCObject.h" NS_CC_BEGIN -class CC_DLL CCImage +class CC_DLL CCImage : public CCObject { public: CCImage(); diff --git a/cocos2dx/textures/CCTextureCache.cpp b/cocos2dx/textures/CCTextureCache.cpp index a6d217b5f4..f69594fa62 100644 --- a/cocos2dx/textures/CCTextureCache.cpp +++ b/cocos2dx/textures/CCTextureCache.cpp @@ -679,7 +679,7 @@ VolatileTexture::VolatileTexture(CCTexture2D *t) VolatileTexture::~VolatileTexture() { textures.remove(this); - CC_SAFE_FREE(uiImage); + CC_SAFE_RELEASE(uiImage); } void VolatileTexture::addImageTexture(CCTexture2D *tt, const char* imageFileName, CCImage::EImageFormat format) @@ -700,7 +700,7 @@ void VolatileTexture::addImageTexture(CCTexture2D *tt, const char* imageFileName void VolatileTexture::addCCImage(CCTexture2D *tt, CCImage *image) { VolatileTexture *vt = findVolotileTexture(tt); - + image->retain(); vt->uiImage = image; vt->m_eCashedImageType = kImage; }