Skip to content

Commit

Permalink
Merge branch 'Tencent:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnoChenFx authored Feb 17, 2025
2 parents 1f4b1c5 + 0ea3ade commit e8f3387
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2223,7 +2223,7 @@ struct JsEnvPrivate
pesapi_env_ref envRef;
std::mutex pendingKillRefsMutex;
std::unordered_set<pesapi_value_ref> pendingKillRefs;
std::unordered_set<Il2CppObject*, std::hash<void*>, std::equal_to<void>, il2cpp::gc::Allocator<Il2CppObject*>> objectPool;
std::unordered_set<Il2CppObject*, std::hash<void*>, std::equal_to<void*>, il2cpp::gc::Allocator<Il2CppObject*>> objectPool;

JsEnvPrivate(struct pesapi_ffi* inApis, pesapi_env_ref inEnvRef)
: apis(inApis), envRef(inEnvRef)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ struct MethodInfoHelper
{
};

Il2CppMethodPointer GetMethodPointer(const MethodInfo* method);
static Il2CppMethodPointer GetMethodPointer(const MethodInfo* method);

template <class _Ret, class... _Args>
struct MethodInfoHelper<_Ret (_Args...)>
Expand Down
6 changes: 6 additions & 0 deletions unity/native_src/Src/JSEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions unreal/Puerts/Source/JsEnv/Public/JsObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit e8f3387

Please sign in to comment.