Home Game Development CCTexture2D crash on cocos2d-x v3 – C++

CCTexture2D crash on cocos2d-x v3 – C++

CCTexture2D crash on cocos2d-x v3 – C++


I’ve skilled a crash that’s brought on by a return on opengl error in initWithMipmaps technique. This crash solely occurs when cocos’s font atlas is used. The reason being: when early return is used, _name is about however _pixelFormat isn’t set. When Texture2D::updateWithData technique is known as from font atlas, it passes _name null verify nevertheless it crashes on at technique of std::map as a result of _pixelFormat hasn’t been set and it’s worth is PixelFormat::AUTO enum worth and a format information doesn’t current for PixelFormat::AUTO in _pixelFormatInfoTables map. I’ve checked cocos2d-x v4 and this code block had been eliminated on this model. Ought to we take away this code block on cocos2d 3.17 whether it is secure to take away? I added the code snippet from CCTexture2D. The road numbers are 688-693 on cocos2d-x 3.17.

The code snippet is from initWithMipmaps in CCTexture2D on v3.17:

err = glGetError();
if (err != GL_NO_ERROR)
    CCLOG("cocos2d: Texture2D: Error importing compressed texture degree: %u . glError: 0xpercent04X", i, err);
    return false;



Please enter your comment!
Please enter your name here