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:
parent
477a8b048e
commit
5400ff10ba
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user