We are migrating issue tracker of Cocos2d-x Project to Github, please create new issue there. Thanks.
TextureCache::addUIImage cannot create texture when key is null, but the document said it can
TextureCache::addUIImage cannot create texture when key is null, but the document said it can
It wasn’t as simple as just fixing the Assert, posting the complete (patched)
method here: (key is implicitely converted to a string through the string(char const* str) constructor, so I took the liberty to remove the forKey variable, all checks need to be performed on the key variable anyways).
CCTexture2D* CCTextureCache::addUIImage(CCImage image, const charkey)
{
CCAssert(image != NULL, “TextureCache: image MUST not be nill”);
CCTexture2D * texture = NULL;
m_pDictLock~~>lock;
do
{
// If key is nil, then create a new texture each time
if))
{
break;
}
// prevents overloading the autorelease pool
texture = new CCTexture2D;
texture~~>initWithImage(image);
if(texture)
{
if(key != 0) {
m_pTextures~~>setObject;
}
texture~~>autorelease();
}
else
{
CCLOG ("cocos2d: Couldn't add UIImage in CCTextureCache");
}
} while (0);
m_pDictLock->unlock();
return texture;
}
- Project changed from cocos2d-x to cpp
- Category deleted (
5) - Target version deleted (
cocos2d-1.0.1-x-0.11.0)
Status: | Closed | |
---|---|---|
Start date: | 2011-12-12 | |
Priority: | Normal | |
Due date: | ||
Assignee: | ||
% Done: | 100% |
|
Category: | - | |
Target version: | - |
reported at http://www.cocos2d-x.org/boards/6/topics/5968
I guess we added CCAssert too more conditions, or the document must be corrected.