You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
local Test2Impl = UnLua.Class()
---由于是重写函数,c++从FFunctionDesc::CallLuaInternal调用过来,有一层FGuard
function Test2Impl:TestImpl()
local testObj = NewObject(UE.UTestClass1, GameInstance)
local testRef = UnLua.Ref(testObj)
local testArr = testObj.TestArr
--testArr正常,可以打印出长度为0
UnLua.Log("########### Test arrptr callTest 1: " .. testArr:Length())
--触发函数调用,由于TestFun2函数在c++中调用了TestImp2,触发了FFunctionDesc::CallLuaInternal
--开启了新的FGuard,执行结束后FGuard析构testArr 被销毁
self:TestFun2()
--testArr报错失效
UnLua.Log("########### Test arrptr callTest 2 : " .. testArr:Length())
end
function Test2Impl:TestImp2()
UnLua.Log("########### TTest2Impl:TestImp2()")
end
return Test2Impl
3、在lua中创建UTestClass2 并调用TestFun,报错 局部变量testArr被销毁
local obj = NewObject(UE.UTestClass2, GameInstance)
obj:TestFun()
The text was updated successfully, but these errors were encountered:
lzj10
changed the title
开启多层FDanglingCheck::FGuard后,最内层的FGuard销毁会销毁所有的CapturedContainers和CapturedStructs
开启多层FDanglingCheck::FGuard后,最内层的FGuard销毁会销毁所有的CapturedContainers和CapturedStructs(invalid TArray)
Oct 15, 2024
开启多层FDanglingCheck::FGuard后,最内层的FGuard析构会销毁所有的CapturedContainers和CapturedStructs,导致外层的局部变量失效。
出现场景,委托回调到lua,在lua中创建umg,之后局部变量失效
复现方式
1、创建UTestClass,UTestClass2
2、lua文件Test2Impl.lua
3、在lua中创建UTestClass2 并调用TestFun,报错 局部变量testArr被销毁
The text was updated successfully, but these errors were encountered: