QSharedPointer 指定给 RtlFreeHeap 的地址无效

发布于 2024-09-24 21:13:45 字数 565 浏览 0 评论 0原文

我有一个程序大量使用QSharedPointer。当我执行我的程序时,它运行良好,但是当我使用 GDB 调试它时,它开始抛出错误。 “指定给 RtlFreeHeap 的无效地址” 在以下代码中抛出:

QSharedPointer<PersistentList> p = 
   PersistentList::createEx(wrap("abc")).dynamicCast<PersistentList>();    

QSharedPointer<IPersistentCollection> c = p->empty(); // Error thrown after this line    

QSharedPointer<IPersistentCollection> ASeq::empty()
{
    return QSharedPointer<EmptyList>(new EmptyList());
}

如果我禁用 p->empty() 行,程序运行得很好。有什么想法吗?

I have a program that makes heavy use of QSharedPointer. When I execute my program it runs fine, but when I debug it with GDB it starts throwing errors. "Invalid Address specified to RtlFreeHeap" is thrown in the following code:

QSharedPointer<PersistentList> p = 
   PersistentList::createEx(wrap("abc")).dynamicCast<PersistentList>();    

QSharedPointer<IPersistentCollection> c = p->empty(); // Error thrown after this line    

QSharedPointer<IPersistentCollection> ASeq::empty()
{
    return QSharedPointer<EmptyList>(new EmptyList());
}

If I disable the p->empty() line the program runs just fine. Any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

御守 2024-10-01 21:13:45

问题可能出在代码的其他地方。在 Valgrind 下运行它,看看您是否接触了不属于您的内存,或使用了未初始化的数据等。

The problem is likely elsewhere in your code. Run it under Valgrind and see if you're touching any memory that's not yours, or using uninitialized data, etc.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文