-
Notifications
You must be signed in to change notification settings - Fork 349
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
使用luapanda调试unlua工程时候,偶现crash #41
Comments
我们定位了一下问题,crash发生在LuaPanda.lua processWatchedExp函数2575行
这行的作用是把观察变量取得的变量值,转换为string。之后序列化发给前台以便展示。 必现办法是:比如在watch中加入UE4.FVector,调试器就会立刻crash掉。 问题可能的原因是unlua目前对一些变量的tostring没有处理好,我们后面看下有没有办法绕过 |
请问现在有解决的办法吗? |
想先说下调试器对变量进行 tostring() 的原因: 所以我认为这里有两种可能,一种是 unlua 修复变量的 tostring() 方法。另一种是 unlua 提供他们自己的的变量序列化方法,我们做一下适配也可以解决。 就这个问题我理解比较依赖 unlua 的处理,核心是找到一个不 crash 的变量序列化方法。 感谢提问,我们也会关注这个问题~ |
我测试了一下,这是因为UE.FVector这个用法不会走FVector的构造,导致调用tostring的时候传递进去的是一个空指针。而UE4.FVector()就可以。 这样是OK的: function Cube_Blueprint_C:ReceiveBeginPlay()
print(tostring(UE4.FVector()))
end 这样就不会调用FVector_New,从而在调用tostring的时候会crash: function Cube_Blueprint_C:ReceiveBeginPlay()
print(tostring(UE4.FVector))
end |
收到。根据上面结果,我的初步想法是:在调试器获取到要展示的变量后,通过某些方式(按变量名或者type()等)判断它是 lua 基本类型还是 unlua 的 UE4.xxx 类型,如果是基础类型,就直接用tostring()序列化。如果是UE4.xxx, 那么调用它一下再使用tostring。 |
unlua 的更新似乎解决了这个bug, 参见下方相关issue |
使用luapanda调试unlua工程时候,有时会出现如下错误
UE4Editor_UnLua!FVector::ToString()
然后unreal就自动关闭了
环境:
操作系统 win10
unreal 4.22.3
luapanda 3.0.1
偶现,但出现概率挺高,看能否解决
The text was updated successfully, but these errors were encountered: