cocos2d-x 2.1.1 crash :(

Hi, I have a crash when cocos2d run in background. The crash is:

stack:

#0 0x37ac3e22 in gpus_ReturnNotPermittedKillClient ()
#1 0x37ac4758 in gpusSubmitDataBuffers ()
#2 0x3328df30 in SubmitPacketsIfAny ()
#3 0x356de302 in gliPresentViewES ()
#4 0x356e6dd8 in ~~
#5 0x005dc74e in EAGLContext_presentRenderbuffer
#6 0x000cb286 in~~[EAGLView swapBuffers] at /libs/cocos2dx/platform/ios/EAGLView.mm:319
#7 0x000c50ee in cocos2d::CCEGLView::swapBuffers() at /libs/cocos2dx/platform/ios/CCEGLView.mm:70
#8 0x0007f13c in cocos2d::CCDirector::drawScene() at /libs/cocos2dx/CCDirector.cpp:254
#9 0x000808e0 in cocos2d::CCDisplayLinkDirector::mainLoop() at /libs/cocos2dx/CCDirector.cpp:946
#10 0x000c4a96 in at /libs/cocos2dx/platform/ios/CCDirectorCaller.mm:93
#11 0x005dbb3a in
[DYDisplayLinkInterposer forwardDisplayLinkCallback:] ()
#12 0x35e6a098 in CA::Display::DisplayLink::dispatch(unsigned long long, unsigned long long) ()
#13 0x35e69ff0 in CA::Display::IOMFBDisplayLink::callback(IOMobileFramebuffer*, unsigned long long, unsigned long long, unsigned long long, void**)
#14 0x380c5fd6 in IOMobileFramebufferVsyncNotifyFunc
#15 0x34e64448 in IODispatchCalloutFromCFMessage
#16 0x342475da in*CFMachPortPerform ()
#17 0x34252172 in CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION ()
#18 0x34252116 in CFRunLoopDoSource1
#19 0x34250f98 in
CFRunLoopRun ()
#20 0x341c3ebc in CFRunLoopRunSpecific ()
#21 0x341c3d48 in CFRunLoopRunInMode ()
#22 0x37d7a2ea in GSEventRunModal ()
#23 0x360d9300 in UIApplicationMain ()
#24 0x001f00c2 in main at /…/…/LeEnGameFramework4.0/frw/external/cocos2dx_projects/ios/main.m:14
#25 0x00065888 in start ()

the crash is in EAGLView.mm row 319:

if(![context_ presentRenderbuffer:GL_RENDERBUFFER])

with a EXC_BADACCESS (code=1, address=0x1)

If I remove setAnimationInterval in
void CCDirector::pause(void)/void CCDirector::resume(void) and write stopAnimation()/startAnimation(), the game doesn’t crashed!

Any idea please?

Regards!

Stefano

Did u find a fix?

The Devil wrote:

Did u find a fix?

No, I have disabled stop and start Animation. Do you have a solution? :slight_smile:

Regards!

No. Looking for a fix.

Any news?

Try this in AppDelegate.cpp:

void AppDelegate::applicationDidEnterBackground()
{
//    CCDirector::sharedDirector()->pause();
    CCDirector::sharedDirector()->stopAnimation();
}

void AppDelegate::applicationWillEnterForeground()
{
//    CCDirector::sharedDirector()->resume();
    CCDirector::sharedDirector()->startAnimation();
}