diff --git a/unity/Assets/core/upm/Editor/Resources/puerts/xil2cpp/Puerts_il2cpp.cpp.txt b/unity/Assets/core/upm/Editor/Resources/puerts/xil2cpp/Puerts_il2cpp.cpp.txt index 861ad17b5b..b31775f7f4 100644 --- a/unity/Assets/core/upm/Editor/Resources/puerts/xil2cpp/Puerts_il2cpp.cpp.txt +++ b/unity/Assets/core/upm/Editor/Resources/puerts/xil2cpp/Puerts_il2cpp.cpp.txt @@ -2223,7 +2223,7 @@ struct JsEnvPrivate pesapi_env_ref envRef; std::mutex pendingKillRefsMutex; std::unordered_set pendingKillRefs; - std::unordered_set, std::equal_to, il2cpp::gc::Allocator> objectPool; + std::unordered_set, std::equal_to, il2cpp::gc::Allocator> objectPool; JsEnvPrivate(struct pesapi_ffi* inApis, pesapi_env_ref inEnvRef) : apis(inApis), envRef(inEnvRef) diff --git a/unity/Assets/core/upm/Editor/Resources/puerts/xil2cpp/TDataTrans.h.txt b/unity/Assets/core/upm/Editor/Resources/puerts/xil2cpp/TDataTrans.h.txt index fc9a7f5ced..317b36670e 100644 --- a/unity/Assets/core/upm/Editor/Resources/puerts/xil2cpp/TDataTrans.h.txt +++ b/unity/Assets/core/upm/Editor/Resources/puerts/xil2cpp/TDataTrans.h.txt @@ -545,7 +545,7 @@ struct MethodInfoHelper { }; -Il2CppMethodPointer GetMethodPointer(const MethodInfo* method); +static Il2CppMethodPointer GetMethodPointer(const MethodInfo* method); template struct MethodInfoHelper<_Ret (_Args...)> diff --git a/unity/native_src/Src/JSEngine.cpp b/unity/native_src/Src/JSEngine.cpp index d108820569..3ac1abcd28 100644 --- a/unity/native_src/Src/JSEngine.cpp +++ b/unity/native_src/Src/JSEngine.cpp @@ -210,6 +210,12 @@ namespace PUERTS_NAMESPACE #ifdef WITH_IL2CPP_OPTIMIZATION CppObjectMapper.UnInitialize(MainIsolate); #endif + + for (int i = 0; i < CallbackWithFinalizeInfos.size(); ++i) + { + CallbackWithFinalizeInfos[i]->JsFunction.Reset(); + } + BackendEnv.UnInitialize(); for (int i = 0; i < CallbackInfos.size(); ++i) diff --git a/unreal/Puerts/Source/JsEnv/Public/JsObject.h b/unreal/Puerts/Source/JsEnv/Public/JsObject.h index 9d72976350..8d1b890ad6 100644 --- a/unreal/Puerts/Source/JsEnv/Public/JsObject.h +++ b/unreal/Puerts/Source/JsEnv/Public/JsObject.h @@ -49,6 +49,8 @@ struct FJsObject #ifdef THREAD_SAFE v8::Locker Locker(Isolate); #endif + v8::Isolate::Scope IsolateScope(Isolate); + v8::HandleScope HandleScope(Isolate); GContext.Reset(Isolate, InOther.GContext.Get(Isolate)); GObject.Reset(Isolate, InOther.GObject.Get(Isolate)); JsEnvLifeCycleTracker = PUERTS_NAMESPACE::DataTransfer::GetJsEnvLifeCycleTracker(Isolate); @@ -96,6 +98,8 @@ struct FJsObject return *this; } Isolate = InOther.Isolate; + v8::Isolate::Scope IsolateScope(Isolate); + v8::HandleScope HandleScope(Isolate); GContext.Reset(Isolate, InOther.GContext.Get(Isolate)); GObject.Reset(Isolate, InOther.GObject.Get(Isolate)); JsEnvLifeCycleTracker = PUERTS_NAMESPACE::DataTransfer::GetJsEnvLifeCycleTracker(Isolate);