diff --git a/unreal/Puerts/Source/JsEnv/Public/JsObject.h b/unreal/Puerts/Source/JsEnv/Public/JsObject.h index b487f3304d..8d1b890ad6 100644 --- a/unreal/Puerts/Source/JsEnv/Public/JsObject.h +++ b/unreal/Puerts/Source/JsEnv/Public/JsObject.h @@ -49,8 +49,10 @@ struct FJsObject #ifdef THREAD_SAFE v8::Locker Locker(Isolate); #endif - GContext.Reset(Isolate, InOther.GContext); - GObject.Reset(Isolate, InOther.GObject); + 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,8 +98,10 @@ struct FJsObject return *this; } Isolate = InOther.Isolate; - GContext.Reset(Isolate, InOther.GContext); - GObject.Reset(Isolate, InOther.GObject); + 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); return *this; }