PDA

View Full Version : qlist error



knishaq
20th December 2009, 13:32
Hi,

I am doing following in the attached file 1.txt.

a) read a list
b) for each item in the list
c) run an external process save it in A file
d) read A file, save modification in B file
e) thatz it

and following error occurs.

ASSERT failure in QList<T>::operator[]: "index out of range", file /opt/qtsdk-2009.02/qt/include/QtCore/qlist.h, line 403

2.txt is one instance of file 1.txt ( no loop ) and it runs successfully.

How is it possible to have the loop run successfully modifying the file.
Please suggest with an example. That will help.

PS: you will need file queue_output.txt in tmp folder to run this code.

Lykurg
20th December 2009, 13:48
The error is in here:
while(!tFile->atEnd())
{

line = tFile->readLine();
QStringList lineWithoutSlashAnne_01 = QString(line).split("\n");

lineWithoutSlashAnne_02 = lineWithoutSlashAnne_01[i]; ///<- i is an iterator for queueList and not for the stringlist.
/// And therfor as the error says: i is out of lineWithoutSlashAnne_01 range.
if (lineWithoutSlashAnne_02.contains(QRegExp("^projects")))
{
lineWithoutSlashAnne_02.append(" "+projNm);
// come a line back remove the project line and add this line
qDebug() << "project " << lineWithoutSlashAnne_02;

}
out << lineWithoutSlashAnne_02 << endl;
}

And I don't know what you are doing...

wysota
20th December 2009, 14:07
And I don't know what you are doing...

He is starting multiple threads on the same subject which starts to annoy me.