From 817a9c14a3aa1d4c162071521e45e2fcce473d77 Mon Sep 17 00:00:00 2001 From: Dmitri Fedortchenko Date: Wed, 18 Mar 2015 12:43:40 +0100 Subject: [PATCH] Fixed crash bug related to CCLabelBMFonts More info here: http://stackoverflow.com/questions/19236534/ios-7-and-cocos2d-exc-bad-access-on-gldrawelements-completely-random And here: https://github.com/jllust/cocos2d-x/commit/1f3c1145362c921bf5232c4ffbca4a5245042bae --- cocos2d/CCDrawNode.m | 1 + cocos2d/CCParticleSystemQuad.m | 3 +++ cocos2d/CCTextureAtlas.m | 1 + 3 files changed, 5 insertions(+) diff --git a/cocos2d/CCDrawNode.m b/cocos2d/CCDrawNode.m index 24b6adeb8..253620e71 100644 --- a/cocos2d/CCDrawNode.m +++ b/cocos2d/CCDrawNode.m @@ -162,6 +162,7 @@ -(void)dealloc glDeleteBuffers(1, &_vbo); _vbo = 0; glDeleteVertexArrays(1, &_vao); _vao = 0; + ccGLBindVAO(0); [super dealloc]; } diff --git a/cocos2d/CCParticleSystemQuad.m b/cocos2d/CCParticleSystemQuad.m index c60b5b4fa..28ad1e78d 100644 --- a/cocos2d/CCParticleSystemQuad.m +++ b/cocos2d/CCParticleSystemQuad.m @@ -162,6 +162,7 @@ - (void) setTotalParticles:(NSUInteger)tp // clean VAO glDeleteBuffers(2, &_buffersVBO[0]); glDeleteVertexArrays(1, &_VAOname); + ccGLBindVAO(0); [self initVAO]; } @@ -227,6 +228,7 @@ -(void) dealloc glDeleteBuffers(2, &_buffersVBO[0]); glDeleteVertexArrays(1, &_VAOname); + ccGLBindVAO(0); } [super dealloc]; @@ -489,6 +491,7 @@ -(void) setBatchNode:(CCParticleBatchNode *)batchNode glDeleteBuffers(2, &_buffersVBO[0]); glDeleteVertexArrays(1, &_VAOname); + ccGLBindVAO(0); } } } diff --git a/cocos2d/CCTextureAtlas.m b/cocos2d/CCTextureAtlas.m index ccf6f1ca8..ff8e00e3b 100644 --- a/cocos2d/CCTextureAtlas.m +++ b/cocos2d/CCTextureAtlas.m @@ -140,6 +140,7 @@ -(void) dealloc #if CC_TEXTURE_ATLAS_USE_VAO glDeleteVertexArrays(1, &_VAOname); + ccGLBindVAO(0); #endif [_texture release];