fixed #1224: Memory leak in CCParticleSystem::initWithDictionary()

This commit is contained in:
James Chen 2012-05-23 11:18:04 +08:00
parent 4353b07aed
commit d998b54269
3 changed files with 6 additions and 4 deletions

View File

@ -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");

View File

@ -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();

View File

@ -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;
}