From c5d7cbf2ef817b1b8a732ae8909ef900220ddcfd Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Fri, 20 May 2011 03:04:30 +0200 Subject: [PATCH] * Prevent locking? --- src/libtomahawk/pipeline.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/libtomahawk/pipeline.cpp b/src/libtomahawk/pipeline.cpp index f6703e82f..5f936fa4d 100644 --- a/src/libtomahawk/pipeline.cpp +++ b/src/libtomahawk/pipeline.cpp @@ -284,7 +284,12 @@ Pipeline::shunt( const query_ptr& q ) // qDebug() << Q_FUNC_INFO << q->solved() << q->toString() << q->id(); unsigned int lastweight = 0; unsigned int lasttimeout = 0; + int rc; int thisResolver = 0; + { + QMutexLocker lock( &m_mut ); + rc = m_resolvers.count(); + } if ( !q->resolvingFinished() ) { @@ -319,9 +324,7 @@ Pipeline::shunt( const query_ptr& q ) if ( lastweight > 0 ) { q->setLastPipelineWeight( lastweight ); - QMutexLocker lock( &m_mut ); - - if ( thisResolver < m_resolvers.count() ) + if ( thisResolver < rc ) { // qDebug() << "Shunting in" << lasttimeout << "ms, q:" << q->toString();