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

LuaArray中inner变量被销毁后,AddReferencedObjects访问inner野指针崩溃的问题 #587

Closed
yish0000 opened this issue Mar 23, 2024 · 9 comments
Labels
bug Something isn't working

Comments

@yish0000
Copy link

Describe the bug
image
image
上述native类派生的蓝图类实例化后,发生上述函数的调用时,产生的LuaArray构造时传入的FProperty是UFunction(OnEnterView)下所属的一个FProperty
假如发生GC的时候,蓝图类被GC,UFunction及其所属FProperty被销毁,此时LuaArray内的inner有可能变为野指针

Version
2.1.3

崩溃堆栈
image
image

@zjhongxian
Copy link
Collaborator

它对应的类按道理应该是会被引用住的。请问下你们是否有强制GC了对应的UClass?

@zjhongxian
Copy link
Collaborator

它对应的类按道理应该是会被引用住的。请问下你们是否有强制GC了对应的UClass?

image

它所对应的类,正常使用下,不应该是被销毁了

@yish0000
Copy link
Author

我们没有强制GC对应的UClass
我看是蓝图类对应的UClass以及其所属的UPackage都被销毁了,这种情况下UClass是怎么被引用的呢

@yish0000
Copy link
Author

image
image
我通过这种修改,暂时不崩溃了

@yish0000
Copy link
Author

image
有没有可能这里面Owner有可能不是UObject,可能Owner的Owner才是UObject

@zjhongxian
Copy link
Collaborator

zjhongxian commented Mar 27, 2024

image 有没有可能这里面Owner有可能不是UObject,可能Owner的Owner才是UObject

大概率是这个原因了,感谢反馈!估计是在你这种嵌套情况下,它的直接Owner是非UObject,导致AddRef出了问题。我明天抽空修复下。

@zjhongxian zjhongxian added the bug Something isn't working label Mar 27, 2024
@yfcyt
Copy link

yfcyt commented Mar 28, 2024

Describe the bug image image 上述native类派生的蓝图类实例化后,发生上述函数的调用时,产生的LuaArray构造时传入的FProperty是UFunction(OnEnterView)下所属的一个FProperty 假如发生GC的时候,蓝图类被GC,UFunction及其所属FProperty被销毁,此时LuaArray内的inner有可能变为野指针

Version 2.1.3

崩溃堆栈 image image

哈喽,想请教一下,你的那个FSmartVisionInfo是怎么定义的?如何才传到Lua中的?我有同样的一个需求,发现无法通过const TArray& 传递到lua层中

@yish0000
Copy link
Author

就是定义的USTRUCT,没什么特别的

@yfcyt
Copy link

yfcyt commented Mar 28, 2024

就是定义的USTRUCT,没什么特别的

大佬有空帮我看看下面的问题吗?
#589

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

No branches or pull requests

3 participants