mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 06:07:37 +02:00
* Protect pipeline from resolvers being removed.
This commit is contained in:
@@ -81,6 +81,8 @@ Pipeline::stop()
|
|||||||
void
|
void
|
||||||
Pipeline::removeResolver( Resolver* r )
|
Pipeline::removeResolver( Resolver* r )
|
||||||
{
|
{
|
||||||
|
QMutexLocker lock( &m_mut );
|
||||||
|
|
||||||
m_resolvers.removeAll( r );
|
m_resolvers.removeAll( r );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,6 +90,8 @@ Pipeline::removeResolver( Resolver* r )
|
|||||||
void
|
void
|
||||||
Pipeline::addResolver( Resolver* r, bool sort )
|
Pipeline::addResolver( Resolver* r, bool sort )
|
||||||
{
|
{
|
||||||
|
QMutexLocker lock( &m_mut );
|
||||||
|
|
||||||
m_resolvers.append( r );
|
m_resolvers.append( r );
|
||||||
if( sort )
|
if( sort )
|
||||||
{
|
{
|
||||||
@@ -168,16 +172,12 @@ Pipeline::reportResults( QID qid, const QList< result_ptr >& results )
|
|||||||
if ( !m_running )
|
if ( !m_running )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
{
|
|
||||||
QMutexLocker lock( &m_mut );
|
|
||||||
|
|
||||||
if ( !m_qids.contains( qid ) )
|
if ( !m_qids.contains( qid ) )
|
||||||
{
|
{
|
||||||
qDebug() << "reportResults called for unknown QID" << qid;
|
qDebug() << "reportResults called for unknown QID" << qid;
|
||||||
Q_ASSERT( false );
|
Q_ASSERT( false );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
const query_ptr& q = m_qids.value( qid );
|
const query_ptr& q = m_qids.value( qid );
|
||||||
if ( !results.isEmpty() )
|
if ( !results.isEmpty() )
|
||||||
@@ -227,10 +227,12 @@ Pipeline::shuntNext()
|
|||||||
if ( !m_running )
|
if ( !m_running )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
unsigned int rc;
|
||||||
query_ptr q;
|
query_ptr q;
|
||||||
{
|
{
|
||||||
QMutexLocker lock( &m_mut );
|
QMutexLocker lock( &m_mut );
|
||||||
|
|
||||||
|
rc = m_resolvers.count();
|
||||||
if ( m_queries_pending.isEmpty() )
|
if ( m_queries_pending.isEmpty() )
|
||||||
{
|
{
|
||||||
if ( m_qidsState.isEmpty() )
|
if ( m_qidsState.isEmpty() )
|
||||||
@@ -251,7 +253,7 @@ Pipeline::shuntNext()
|
|||||||
q->setLastPipelineWeight( 101 );
|
q->setLastPipelineWeight( 101 );
|
||||||
}
|
}
|
||||||
|
|
||||||
setQIDState( q, m_resolvers.count() );
|
setQIDState( q, rc );
|
||||||
new FuncTimeout( 500, boost::bind( &Pipeline::shunt, this, q ), this );
|
new FuncTimeout( 500, boost::bind( &Pipeline::shunt, this, q ), this );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -317,6 +319,7 @@ Pipeline::shunt( const query_ptr& q )
|
|||||||
if ( lastweight > 0 )
|
if ( lastweight > 0 )
|
||||||
{
|
{
|
||||||
q->setLastPipelineWeight( lastweight );
|
q->setLastPipelineWeight( lastweight );
|
||||||
|
QMutexLocker lock( &m_mut );
|
||||||
|
|
||||||
if ( thisResolver < m_resolvers.count() )
|
if ( thisResolver < m_resolvers.count() )
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user