A story about crash in release config at iOS device

Sometimes, usually after long play time my game had crashed. Only at release config.
After debugging i found a reason. In file CCTexturePVR.cpp in function createGLTexture() placed a macro CHECK_GL_ERROR_DEBUG(). It defined that:

#if !defined(COCOS2D_DEBUG) || COCOS2D_DEBUG == 0 #define CHECK_GL_ERROR_DEBUG() #else #define CHECK_GL_ERROR_DEBUG() \ do { \ GLenum __error = glGetError(); \ if(__error) { \ CCLog("OpenGL error 0x%04X in %s %s %d\n", __error, __FILE__, __FUNCTION__, __LINE__); \ } \ } while (false) #endif

I.E. in debug mode it clearing OpenGL errors, but in release mode- NOT! Bottom in this function placed code

err = glGetError();

That catched old OpenGL error (not error, throwing in texture loading time), and function returened false, and app had crashed in cocos code after it.
My solution- in always checking OpenGL errors,not only debug mode. May be, it behaviour must be moved in future release of cocos?

Pull a request on github )