Crash when update to Cocos2d-x 3.0RC from beta

When I update sdk from beta to RC, I met a metal crash problem with GLView
-(void) doCaller: (id) sender
{
cocos2d::Director* director = cocos2d::Director::getInstance();
[EAGLContext setCurrentContext: [(CCEAGLView*)director->getOpenGLView()->getEAGLView() context]];//crash here
director->mainLoop();
}

I have modified codes like this:

bool AppDelegate::applicationDidFinishLaunching() {

// initialize director
auto director = Director::getInstance();
auto glview = director->getOpenGLView();
if(!glview) {
    glview = GLView::create("My Game");
    director->setOpenGLView(glview);
}
....
FileUtils::getInstance()->setSearchPaths(searchPaths);
Director::getInstance()->getOpenGLView()->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, ResolutionPolicy::FIXED_WIDTH);
....

}

What’s wrong with it?


Screen Shot 2014-03-24 at 12.27.02 PM.png (72.6 KB)

The codes you pasted is the same as tests, but there is not crash.
What you modify?

when do you call the doCaller method?

Maybe this will help someone to figure out this bug.
App dos not crash on iPhone with iOS 7.x, and not crash on iPad(retina) with iOS 7.x.
App crash on my iPad with iOS 5.1 at getEAGLView call:
All was tested on mac 10.9.2, Xcode5.1 (5B130a) (deployment target 5.0, uni),

- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
        ...
        CCEAGLView *eaglview = (CCEAGLView*) glview->getEAGLView();

App (or provided cpp tests) was created using cocos new command.

@elensar
Thanks for your feedback. #4607 is created for it.

Do you test this at 5.1 simulator? It’s hard to find an ios5.1 machine, and I didn’t find a way to Rollback the ios version.

Hi boyu0, no i don’t have any 5.1 emulator in the current Xcode.
I do it again, maybe this will help.

a) iPad with 5.1 and 3.0 rc1 tests
5.1 cant contain arm64, only from 5.1.1 (Xcode warn me;)
In Targets–>Build Settings–>Architectures–>Architectures

  • select other, delete $(ARCH_STANDARD) or $(ARCH_STANDARD_INCLUDE…)
  • add armv7
  • add armv7s
  • clean and build
  • test build and run on device (problem solved using only armv7 and armv7s not arm64)

b) iPad with 5.1 and 3.0 rc1 new project (using the cocos new command)

  • building have same issue as “a” test (solved)
  • running the project have error that I already describe (glview…)
  • RootViewController in tests sources and newly created project are different, when i comment in new project part “didRotateFromInterfaceOrientation” project run on my old device
  • didFinishLaunchingWithOptions, creating viewController and interface is in both project little different. I don’t know if this can be a problem.

@elensar
Did you mean the crash happened both in tests and new project? And the crashed in different places? Because as you said, tests doesn’t have didRotateFromInterfaceOrientation.

I think Xcode5.1 doesn’t support ios 5.1 very well

http://stackoverflow.com/questions/22960477/xcode-5-1-stdstring-concatenation-crash-on-ios-5-1-devices-in-release-builds

http://stackoverflow.com/questions/22662420/global-stdstring-causing-crash-on-ios

Maybe try xcode 5.1.1?

@Yehsam
Good to know. Thanks.

@elensar
Could you please use Xcode 5.1.1 to have a try. Because i can not find iOS 5.1 device
Thanks.

@zhangxm wrote:

@elensar
Did you mean the crash happened both in tests and new project? And the crashed in different places? Because as you said, tests doesn’t have didRotateFromInterfaceOrientation.

Test are ok (as I wrote in case A), I managed to run test on 5.1 device without any problem. Solution to run test on 5.1 device is case ** see a)** … to remove arm64 arch and all is ok.
And problem persist only in new project. New project is little different when I compare it with test project. And only working solution to run new project on 5.1 was to comment “didRotateFromInterfaceOrientation” function.

Ok I will update Xcode to 5.1.1 and test both case again.

@elensar wrote:

@zhangxm wrote:

@elensar
Did you mean the crash happened both in tests and new project? And the crashed in different places? Because as you said, tests doesn’t have didRotateFromInterfaceOrientation.

Test are ok (as I wrote in case A), I managed to run test on 5.1 device without any problem. Solution to run test on 5.1 device is case ** see a)** … to remove arm64 arch and all is ok.
And problem persist only in new project. New project is little different when I compare it with test project. And only working solution to run new project on 5.1 was to comment “didRotateFromInterfaceOrientation” function.

Ok I will update Xcode to 5.1.1 and test both case again.

Thanks. We reproduced the issue in an iPhone with iOS 5.0.1. We will fix it soon.

Fixed in this pull request.