mirror of https://github.com/axmolengine/axmol.git
Fix window.close crash in JSB
This commit is contained in:
parent
4dfa9d1719
commit
e7e365a00f
|
@ -386,7 +386,13 @@ bool JSB_core_restartVM(JSContext *cx, uint32_t argc, jsval *vp)
|
|||
|
||||
bool JSB_closeWindow(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
ScriptingCore::getInstance()->cleanup();
|
||||
EventListenerCustom* _event = Director::getInstance()->getEventDispatcher()->addCustomEventListener(Director::EVENT_AFTER_DRAW, [&](EventCustom *event) {
|
||||
Director::getInstance()->getEventDispatcher()->removeEventListener(_event);
|
||||
_event->release();
|
||||
|
||||
ScriptingCore::getInstance()->cleanup();
|
||||
});
|
||||
_event->retain();
|
||||
Director::getInstance()->end();
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
|
||||
exit(0);
|
||||
|
|
Loading…
Reference in New Issue