Skip to content

Commit

Permalink
[unreal]mixin基类,objectTakeByNative设置为true时,同步设置其子类objectTakeByNative为…
Browse files Browse the repository at this point in the history
…true,fix #1658
  • Loading branch information
chexiongsheng committed Feb 20, 2024
1 parent d5b8128 commit 04a27ff
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions unreal/Puerts/Source/JsEnv/Private/JsEnvImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3052,10 +3052,15 @@ FJsEnvImpl::FTemplateInfo* FJsEnvImpl::GetTemplateInfoOfType(UStruct* InStruct,
if (SuperClass)
{
bool Dummy;
if (IsReuseTemplate)
__USE(GetTemplateInfoOfType(SuperClass, Dummy));
else
Template->Inherit(GetTemplateInfoOfType(SuperClass, Dummy)->Template.Get(Isolate));
auto SuperTemplateInfo = GetTemplateInfoOfType(SuperClass, Dummy);
if (!IsReuseTemplate)
{
Template->Inherit(SuperTemplateInfo->Template.Get(Isolate));
}
if (SuperTemplateInfo->StructWrapper->IsNativeTakeJsRef)
{
StructWrapper->IsNativeTakeJsRef = true;
}
}
}

Expand Down Expand Up @@ -4315,6 +4320,16 @@ void FJsEnvImpl::Mixin(const v8::FunctionCallbackInfo<v8::Value>& Info)
bool IsReuseTemplate = false;
auto StructWrapper = GetStructWrapper(New, IsReuseTemplate);
StructWrapper->IsNativeTakeJsRef = TakeJsObjectRef;
if (TakeJsObjectRef)
{
for (auto& KV : TypeToTemplateInfoMap)
{
if (New != KV.Key && KV.Key->IsChildOf(New))
{
KV.Value.StructWrapper->IsNativeTakeJsRef = true;
}
}
}
Info.GetReturnValue().Set(FindOrAdd(Isolate, Context, New->GetClass(), New));
}
#endif
Expand Down

0 comments on commit 04a27ff

Please sign in to comment.