switch between UIView and EAGLView

  1. set RootViewController with an UIView, for platform sdk,
  2. push the other ViewController with an EAGLView for cocos2dx, after user auth is finished.
  3. dismiss the ViewController holding cocos2dx view in case of logout, back to the former ViewController.
  4. login again and try to switch to the controller with EAGLView.
    then crush occurred in the step of “cocos2d::CCApplication::sharedApplication()->run();”, for specific call stack it stopped at “JS::CompileOptions options(cx);”, it seems the address for cx is illegal (not null).

ps. in step 3, I use these code in order to release cocos2dx related res:

[self dismissViewControllerAnimated:NO completion:^(void){
cocos2d::CCDirector::sharedDirector()->end();
ScriptingCore::getInstance()->cleanup();
}];

I’m new in objc programming, is anything wrong for this case?
I hope it’s not a bug in scriptingCore…