issue #129, add obj->release when obj is inserted into NSDictionary

This commit is contained in:
Walzer 2010-09-08 06:52:56 +00:00
parent 48859df034
commit cba41dc44b
2 changed files with 18 additions and 9 deletions

View File

@ -216,16 +216,17 @@ CCTexture2D * CCTextureCache::addImage(const char * path)
CCX_SAFE_DELETE(image);// image->release();
if( texture )
{
m_pTextures->setObject(texture, fullpath);
texture->autorelease();
}
else
{
CCLOG("cocos2d: Couldn't add image:%s in CCTextureCache", path);
texture->release();
}
}
}
m_pDictLock->unlock();
return texture;
}
@ -250,13 +251,16 @@ CCTexture2D* CCTextureCache::addPVRTCImage(const char* path, int bpp, bool hasAl
texture = new CCTexture2D();
texture->initWithPVRTCData(data->bytes(), 0, bpp, hasAlpha, width);
if( texture )
{
m_pTextures->setObject(texture, temp);
texture->autorelease();
}
else
{
CCLOG("cocos2d: Couldn't add PVRTCImage:%s in CCTextureCache",path);
}
CCX_SAFE_DELETE(data);
texture->autorelease();
return texture;
}
@ -274,11 +278,15 @@ CCTexture2D * CCTextureCache::addPVRTCImage(const char* fileimage)
texture = new CCTexture2D();
texture = texture->initWithPVRTCFile(fileimage);
if( texture )
{
m_pTextures-> setObject( texture, key);
texture->autorelease();
}
else
CCLOG("cocos2d: Couldn't add PVRTCImage:%s in CCTextureCache",fileimage);
{
CCLOG("cocos2d: Couldn't add PVRTCImage:%s in CCTextureCache",fileimage);
}
texture->autorelease();
return texture;
}
#endif
@ -326,12 +334,12 @@ CCTexture2D* CCTextureCache::addUIImage(UIImage *image, const char *key)
if(texture)
{
m_pTextures->setObject(texture, forKey);
texture->autorelease();
}
else
{
CCLOG("cocos2d: Couldn't add UIImage in CCTextureCache");
}
texture->autorelease();
return texture;
}

View File

@ -326,6 +326,7 @@ namespace cocos2d {
CCXStringToStringDictionary *dict = new CCXStringToStringDictionary();
pTMXMapInfo->setParentGID(info->m_uFirstGid + atoi(valueForKey("id", attributeDict)));
pTMXMapInfo->getTileProperties()->setObject(dict, pTMXMapInfo->getParentGID());
CCX_SAFE_RELEASE(dict);
pTMXMapInfo->setParentElement(TMXPropertyTile);