c++ - QList<T>::at: "index out of range"中的 qt ASSERT 失败

标签 c++ qt runtime-error

我对 Qt 还是比较陌生,最近我在做一个大型项目。当我尝试运行该项目时出现此错误:

ASSERT failure in QList<T>::at: "index out of range", file c:\qt\qt5.3.0\5.3\msvc2013_64\include\qtcore\qlist.h, line 479

只是想知道是否有人知道这意味着什么,或者我该如何追踪问题的根源?

[edit] 我相信添加这段代码是导致错误的原因

autAtom *aP = new autAtom(Principal);
    autAtom *aQ = new autAtom(Principal);

    autData *P = new autData (DataAtom, aP);
    autData *Q = new autData (DataAtom, aQ);
    autData *X = new autData (AnyData);

    AUTPostulate *p;
    autStatementList preList;


    {
        preList.clear();
        //autData *d1 = new autData(NotHereData, X);
        autStatement *pre1 = new autStatement(aP, believes, X);
        autStatement *goal = new autStatement(aP, sees, X);
        preList.append(pre1);
        p = new AUTPostulate("BS", BS, goal, preList);
        cout << "" << p->getString().toStdString() << endl;
        AUTPostulates.append(p);

    }

取出后,工具运行正常。

最佳答案

我遇到了类似的问题,因为我在填充小部件之前在 itemChanged 上执行了 connect,然后在填充时调用了我的插槽代码。在我放入一个防止在小部件填充期间进行信号处理的防护装置之后,我发现我可以很好地填充小部件,并且之后我也可以很好地处理信号。希望这会有所帮助。

关于c++ - QList<T>::at: "index out of range"中的 qt ASSERT 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24956265/

相关文章:

c++ - 无需运行即可构建 CLion

C++ QT 将 QList 中的项目转换为子类

c++ - 无法在 QtCreator 中调试应用程序

linux - 如何在 Linux 中构建完全静态的 QT 应用程序?

java - 运行测试android应用程序时出现几个错误

c++ - 类函数指针作为参数

c++ - 从键盘读取多行作为输入

c++ - 使用动态库时 undefined reference 问题

Android:在运行时从 SQLite 数据库中读取

c++ - 使用 std::string 导致 Windows "Entry Point Not Found"