Comment 15 for bug 801700

Revision history for this message
Daniel Schürmann (daschuer) wrote :

Hi Max,

I like the Idea of using QMutexlLocker, it is always good to use the benefit of c++!
Now the mutex is unlocked later than before in some cases. Please consider to put the critical section in an own code block and use expicit QMutexLocke::unlock() if required.

like
{ // Critical section
     QMutexLocker locker(&m_sTracksMutex);
     ... critical code
}
... non critical code

-------------------

The QVector<QVariant>& record is resized to allocate the needed memory for the columns at once.
So we can later copy the content using record[i] = ...;
Otherwise we had to use record.append which is slower, I think!

I should have put commends in the code.

An additional thought:
record[i] = ...; preforms a deep copy of the QVariant object (QString in most cases).
This should be the most time consuming task in the loop.
You could improve this by giving getTrackValueForColumn a pointer to the just created QVariant record[i], instead of crate a new QVariant on stack and copy its content (twice).

Kind regards,

Daniel