deleting first item in a list
i have subclasses kprocess and want to buffer output in a qstringlist.
when output is received i do this:
Code:
m1.lock();
for ( QStringList::Iterator it
= temp.
begin(); it
!= temp.
end();
++it
) mStdoutBuffer.append(*it);
m1.unlock();
and when the buffer is read this code is exeuted:
Code:
/// reads first line from Buffer and then removes it so content "moves up"
if (canReadLineStdout() && ( m1.tryLock()))
{
QString Buffer
= mStdoutBuffer.
first();
mStdoutBuffer.remove(*it);
m1.unlock();
return (Buffer);
} else
return ("");
but i get
QGVector::remove: Index 1343941632 out of range
QGVector::insert: Index 1343941632 out of range
what am i doing wrong? (the program mostly doesnt crash but something isnt well for sure)
thanks
Re: deleting first item in a list
So, as I stated in another thread, QMutext::tryLock() already locks the mutex unless another thread has locked it.. :)
Re: deleting first item in a list
i know that, i just forgot to remove the line ...
anway the QGVector errors remain (and they are the ones connected to the question really ;)
thanks