mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 08:02:39 +08:00
Fix crash issue during closing if scene has a label outline component
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user