Fix crash issue during closing if scene has a label outline component

This commit is contained in:
pandamicro
2017-08-09 14:50:54 +08:00
parent 20d121f31f
commit 1d79eecc6e
@@ -937,6 +937,12 @@ bool ScriptingCore::requireScript(const char *path, JS::HandleObject global, JSC
void ScriptingCore::reset()
{
Director::getInstance()->getEventDispatcher()->dispatchCustomEvent(EVENT_RESET);
// Cleanup js objects
JS::RootedObject global(_cx, _global->get());
JS::RootedValue globalVal(_cx, JS::ObjectOrNullValue(global));
executeFunctionWithOwner(globalVal, "__cleanup", JS::HandleValueArray::empty());
Director::getInstance()->restart();
}
@@ -963,13 +969,6 @@ void ScriptingCore::cleanup()
// clear http client callbacks
network::HttpClient::destroyInstance();
{
// Cleanup js objects
JS::RootedObject global(_cx, _global->get());
JS::RootedValue globalVal(_cx, JS::ObjectOrNullValue(global));
executeFunctionWithOwner(globalVal, "__cleanup", JS::HandleValueArray::empty());
}
// Clear all cached script
cleanAllScript();