Projects > cpp > Issues > Bug #1395

We are migrating issue tracker of Cocos2d-x Project to Github, please create new issue there. Thanks.

Create Issue on Github

CCTextureCache::addImage ignores error in CCTexture2D::initWithImage

Bug #1395 [Closed] 2012-07-14 02:59 . Updated almost 5 years ago

Reported at by mfellner.

In CCTextureCache.cpp:446 (addImage(const char * path)) there is the following problem:

texture = new CCTexture2D();
texture->initWithImage(ℑ, resolution); // returns a boolean

if( texture ) // should check result of previous method call
    // ...
    // this is executed even if there was an error in initWithImage
    texture->release(); // double release will finally result in an error
    CCLOG("cocos2d: Couldn't add image:%s in CCTextureCache", path);

And in CCTexture2D.cpp:272 (initWithImage(CCImage * uiImage, ccResolutionType resolution)):

if (imageWidth > maxTextureSize || imageHeight > maxTextureSize) 
    CCLOG("cocos2d: WARNING: Image (%u x %u) is bigger than the supported %u x %u", imageWidth, imageHeight, maxTextureSize, maxTextureSize);
    return NULL; // should return false instead
zhangxm 2012-07-17 06:31
  • Status changed from New to Closed

Atom PDF

Start date:2012-07-14
Due date:
% Done:


Target version:cocos2d-2.0-x-2.0.2

Sign up for our newsletter to keep up with the latest developments, releases and updates for Cocos2d-x.