Details
-
Bug
-
Resolution: Invalid
-
Not Evaluated
-
None
-
6.8.1
-
None
-
Windows 10, Intel core i5 7th Gen.
Description
Following code works for some values of i (i is the quantity of string object inserted into the list) whilst does not work for others. When it does not work this error is shown:
ASSERT failure in QList::insert: "The specified iterator argument 'before' is invalid", file C:/Qt/6.8.1/llvm-mingw_64/include/QtCore/qlist.h, line 505 qtc.process_stub: Inferior: QProcess::Crashed "Process crashed".
#include <QCoreApplication>
#include <QString>
#include <QList>
#include <QTextStream>
#include <QStringList>
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
QList<QString> list_string;
QList<QString>::iterator list_it;
//QStringList list_string;
//QStringList::iterator list_it;
QTextStream out(stdout);
//functions with element number 1, 5, 6, 15, 16, ...
//does not function with element number 2, 4, 6, 7, 8, 9, ...
for(int i = 0; i < 5; i++)
list_it = list_string.begin();
while(list_it != list_string.end())
{
list_it++;
if(list_it != list_string.end())
}
list_it = list_string.begin();
while(list_it != list_string.end())
return a.exec();
}