为什么当我在 QSortFilterProxyModel 中执行 invalidateFilter() 时出现分段错误

发布于 2025-01-11 15:27:59 字数 2625 浏览 1 评论 0原文

在我的 QSortFilterProxyModel 中,我按槽获取一些字符串:

void FilterModel::OnSetName(const QString &name)
{
    if(!name.isEmpty())
    {
      m_nameToContains=name;
      invalidateFilter();
    }
}

稍后我在重写的方法中使用这些 prop m_nameToContains QString:

virtual bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const Q_DECL_OVERRIDE;

将我的显示角色与这些进行比较。 但有时,在调试时我会收到分段错误错误。 我不在 QSortFilterProxyModel 中使用指针,我的堆栈跟踪是: 输入图片此处描述

我的程序出现在 invalidateFilter() 处。可能是什么原因?我做错了什么?

先进制造:

0x7ffff66de6de                  59                       pop    %rcx
0x7ffff66de6df                  5e                       pop    %rsi
0x7ffff66de6e0                  4c 89 fa                 mov    %r15,%rdx
0x7ffff66de6e3                  4c 89 ee                 mov    %r13,%rsi
0x7ffff66de6e6                  4c 89 e7                 mov    %r12,%rdi
0x7ffff66de6e9                  e8 12 90 ff ff           callq  0x7ffff66d7700
0x7ffff66de6ee                  48 8b b5 78 ff ff ff     mov    -0x88(%rbp),%rsi
0x7ffff66de6f5                  41 b9 01 00 00 00        mov    $0x1,%r9d
0x7ffff66de6fb                  4d 89 f8                 mov    %r15,%r8
0x7ffff66de6fe                  4c 89 e9                 mov    %r13,%rcx
0x7ffff66de701                  48 89 da                 mov    %rbx,%rdx
0x7ffff66de704                  4c 89 e7                 mov    %r12,%rdi
0x7ffff66de707                  e8 64 9b ff ff           callq  0x7ffff66d8270
0x7ffff66de70c                  48 8d 45 90              lea    -0x70(%rbp),%rax
0x7ffff66de710                  48 8b 75 80              mov    -0x80(%rbp),%rsi
0x7ffff66de714                  48 89 c7                 mov    %rax,%rdi
0x7ffff66de717                  48 89 85 60 ff ff ff     mov    %rax,-0xa0(%rbp)
0x7ffff66de71e                  e8 2d 6e ff ff           callq  0x7ffff66d5550
0x7ffff66de723                  4c 89 ef                 mov    %r13,%rdi
0x7ffff66de726                  e8 f5 e2 ec ff           callq  0x7ffff65aca20
0x7ffff66de72b                  48 8b 7d 80              mov    -0x80(%rbp),%rdi
0x7ffff66de72f                  e8 ec e2 ec ff           callq  0x7ffff65aca20
0x7ffff66de734                  48 8d 43 08              lea    0x8(%rbx),%rax
0x7ffff66de738                  4d 8b 74 24 08           mov    0x8(%r12),%r14
0x7ffff66de73d                  48 c7 45 88 00 00 00 00  movq   $0x0,-0x78(%rbp)

In my QSortFilterProxyModel i get some string by slot:

void FilterModel::OnSetName(const QString &name)
{
    if(!name.isEmpty())
    {
      m_nameToContains=name;
      invalidateFilter();
    }
}

Later I use these prop m_nameToContains QString in overrided method:

virtual bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const Q_DECL_OVERRIDE;

to compare my display role with these.
But sometimes, in debug I get an sigmentation fault error.
I do not use pointers in QSortFilterProxyModel, my stack trace is:
enter image description here

My program falls at invalidateFilter(). What's can be the reason? What's i do wrong?

ASM:

0x7ffff66de6de                  59                       pop    %rcx
0x7ffff66de6df                  5e                       pop    %rsi
0x7ffff66de6e0                  4c 89 fa                 mov    %r15,%rdx
0x7ffff66de6e3                  4c 89 ee                 mov    %r13,%rsi
0x7ffff66de6e6                  4c 89 e7                 mov    %r12,%rdi
0x7ffff66de6e9                  e8 12 90 ff ff           callq  0x7ffff66d7700
0x7ffff66de6ee                  48 8b b5 78 ff ff ff     mov    -0x88(%rbp),%rsi
0x7ffff66de6f5                  41 b9 01 00 00 00        mov    $0x1,%r9d
0x7ffff66de6fb                  4d 89 f8                 mov    %r15,%r8
0x7ffff66de6fe                  4c 89 e9                 mov    %r13,%rcx
0x7ffff66de701                  48 89 da                 mov    %rbx,%rdx
0x7ffff66de704                  4c 89 e7                 mov    %r12,%rdi
0x7ffff66de707                  e8 64 9b ff ff           callq  0x7ffff66d8270
0x7ffff66de70c                  48 8d 45 90              lea    -0x70(%rbp),%rax
0x7ffff66de710                  48 8b 75 80              mov    -0x80(%rbp),%rsi
0x7ffff66de714                  48 89 c7                 mov    %rax,%rdi
0x7ffff66de717                  48 89 85 60 ff ff ff     mov    %rax,-0xa0(%rbp)
0x7ffff66de71e                  e8 2d 6e ff ff           callq  0x7ffff66d5550
0x7ffff66de723                  4c 89 ef                 mov    %r13,%rdi
0x7ffff66de726                  e8 f5 e2 ec ff           callq  0x7ffff65aca20
0x7ffff66de72b                  48 8b 7d 80              mov    -0x80(%rbp),%rdi
0x7ffff66de72f                  e8 ec e2 ec ff           callq  0x7ffff65aca20
0x7ffff66de734                  48 8d 43 08              lea    0x8(%rbx),%rax
0x7ffff66de738                  4d 8b 74 24 08           mov    0x8(%r12),%r14
0x7ffff66de73d                  48 c7 45 88 00 00 00 00  movq   $0x0,-0x78(%rbp)

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文