Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[UE] Bug: Mixin创建出的UFunction成员PropertiesSize为0,导致ProcessEvent时崩溃 #1947

Open
3 tasks done
parnny opened this issue Dec 17, 2024 · 3 comments
Open
3 tasks done
Assignees
Labels
bug Something isn't working Unreal

Comments

@parnny
Copy link

parnny commented Dec 17, 2024

前置阅读 | Pre-reading

Puer的版本 | Puer Version

master,lastest

UE的版本 | UE Version

5.4.4

发生在哪个平台 | Platform

Editor(win)

错误信息 | Error Message

ScriptCore.cpp

if (!bUsePersistentFrame)
{
	Frame = (uint8*)UE_VSTACK_ALLOC_ALIGNED(VirtualStackAllocator, Function->PropertiesSize, Function->GetMinAlignment());
	// zero the local property memory
	const int32 NonParmsPropertiesSize = Function->PropertiesSize - Function->ParmsSize;
	if (NonParmsPropertiesSize)
	{
		FMemory::Memzero(Frame + Function->ParmsSize, NonParmsPropertiesSize);
	}
}

Function->PropertiesSize为0, Function->ParmsSize为16, 导致Memzero崩溃

JSGeneratedClass.cpp

  if (!Existed)
  {
      UFunction* Tmp =
          Cast<UFunction>(StaticDuplicateObject(Super, Class, Super->GetFName(), RF_AllFlags, UFunction::StaticClass()));
      Tmp->SetSuperStruct(Super);
      Tmp->Next = Class->Children;
      Class->Children = Tmp;
      Class->AddFunctionToFunctionMap(Tmp, Tmp->GetFName());
      Tmp->SetFlags(Tmp->GetFlags() | RF_Transient);
      Super = Tmp;
  }

此处通过StaticDuplicateObject复制出的Tmp,PropertiesSize、MinAlignment、Script数据与Super均有区别

问题重现 | Bug reproduce

@parnny parnny added bug Something isn't working Unreal labels Dec 17, 2024
@chexiongsheng
Copy link
Collaborator

重现的工程或者步骤?

@parnny
Copy link
Author

parnny commented Dec 17, 2024

重现的工程或者步骤?

1.C++中定义一个类A创建成员方法FuncA
2.在TS中创建类TS_A,Mixin这个类的FuncA方法
3.创建一个TS_A实例
4.调用被Mixin的方法

这问题在 FJsEnvImpl::Mixin 的函数里下断点就能看到,Mixin前类有N个方法,Mixin之后有N+2个,其中copy出来的这个PropertiesSize字段就是0

@chexiongsheng
Copy link
Collaborator

是mixin c++才会有的问题吗?
mixin蓝图有没问题?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Unreal
Projects
None yet
Development

No branches or pull requests

2 participants