1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-21 16:29:43 +01:00

Only lock once while accessing member objects.

Previously we locked/unlocked the internal mutex twice to get
d->results. Also we created an unecessary copy of the list.
This commit is contained in:
Uwe L. Korn 2014-09-18 23:35:45 +01:00
parent 477a8b048e
commit 5400ff10ba

View File

@ -166,8 +166,12 @@ track_ptr
Query::track() const
{
Q_D( const Query );
if ( !results().isEmpty() )
return results().first()->track();
{
QMutexLocker lock( &d->mutex );
if ( !d->results.isEmpty() )
return d->results.first()->track();
}
return d->queryTrack;
}