c++cocos2d-xcocos2d-x-3.0

cc.game.restart() carsh when extend sdkbox in cocos2d-js 3.10


I have an issue and need help. Oh, I realize not only every sdkbox facebook but also just install a sdkbox plugin (like facebook, onesignal ...), all are crashed when calling cc.game.restart().

In AppDelegate.cpp:

#ifdef SDKBOX_ENABLED
    sc->addRegisterCallback(register_all_PluginFacebookJS);
    sc->addRegisterCallback(register_all_PluginFacebookJS_helper);
#endif
    sc->addRegisterCallback(register_all_SpriteExJS);
    sc->start();
    sc->runScript("script/jsb_boot.js");

Thanks


Solution

  • I was able to reproduce the same error and I fixed it in ScriptingCore.cpp with the following code:

    void ScriptingCore::cleanup()
    ...
    
    if(iter->first.compare(0,8,"N6sdkbox") != 0){
          free(iter->second->jsclass);
          free(iter->second);
    }