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

由于引入了QtWidget动态库,GParam中属性值异常 #135

Closed
zmoth opened this issue Jun 29, 2023 · 8 comments
Closed

由于引入了QtWidget动态库,GParam中属性值异常 #135

zmoth opened this issue Jun 29, 2023 · 8 comments
Labels
enhancement New feature or request

Comments

@zmoth
Copy link
Contributor

zmoth commented Jun 29, 2023

相关问题 #133 #134

OS: win10
编译器: MSVC 2022
Qt版本: 6.5.0

复现代码地址 https://github.com/QianMoth/mvc-demo/tree/dev

@zmoth
Copy link
Contributor Author

zmoth commented Jun 29, 2023

在GParam create中,通过CGRAPH_SAFE_MALLOC_COBJECT开辟了一段内存 其地址是0x00000181259b3ea0,关注以下key内容和地址
image

然后在TGParam* getGParam(const std::string& key)中,对param_manager_搜索param1 返回的地址是00000181259B3EA0

之后进入addBacktrace,发现debug信息均正常,指针也对,但是log中打印的不一样
image

@zmoth
Copy link
Contributor Author

zmoth commented Jun 29, 2023

当注释掉Qt的引入

image

image

@zmoth
Copy link
Contributor Author

zmoth commented Jun 29, 2023

当保留Qt库引入,但是改变GParam属性的顺序

private:
    CBool backtrace_enable_ = false;                             // 是否使能backtrace功能
    std::string key_;                                            // 对应的key信息
    USerialUniqueArray<std::string> backtrace_;                  // 记录参数的调用栈信息,仅记录get 此参数的地方。不包括 create和remove的地方。
    USpinLock backtrace_lock_;                                   // 针对backtrace的自旋锁

image

image

@ChunelFeng ChunelFeng added the enhancement New feature or request label Jun 29, 2023
@ChunelFeng
Copy link
Owner

是否可以设定一下 内存断点,确认一下在 异常的情况下, backtrace_enable_ 字段的值(false),是什么时候被改掉的 ?

已经排除人为因素,能否确定到,backtrace_enable_ 该值是在固定位置(如,param创建完毕之后),还是随机位置被修改的?

@ChunelFeng
Copy link
Owner

我还想到有一个事情,GParam 类,自己是没有构造函数的。
请抽空再帮忙确认一下,如果不改动原来的内容,仅添加构造函数,在构造函数中,对 bt_enable 字段赋值,是否还会出现异常情况。

感谢您的pr,欢迎随时交流

@zmoth
Copy link
Contributor Author

zmoth commented Jun 30, 2023

我还想到有一个事情,GParam 类,自己是没有构造函数的。 请抽空再帮忙确认一下,如果不改动原来的内容,仅添加构造函数,在构造函数中,对 bt_enable 字段赋值,是否还会出现异常情况。

感谢您的pr,欢迎随时交流

当自己创建构造函数时,直接就异常了 Critical error detected c0000374

不引入QT时正常。

image

@zmoth
Copy link
Contributor Author

zmoth commented Jun 30, 2023

另外我尝试了降低Qt版本为6.4.3

使用mingw_64正常
使用msvc2019_64还是异常

@ChunelFeng
Copy link
Owner

那看起来,更像是 qt lib的问题了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants