1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-19 15:29:42 +01:00

Move the mutex locker in the query's destructor to try to ensure that no part of the destructor can be happening while access happens some other way.

Also actually lock the mutex in refreshResults() and check for validity of the object.
This commit is contained in:
Jeff Mitchell 2012-01-13 08:52:30 -05:00
parent 25a67447d3
commit ef41c80eb1

View File

@ -102,9 +102,9 @@ Query::Query( const QString& query, const QID& qid )
Query::~Query()
{
QMutexLocker lock( &s_mutex );
if ( !id().isEmpty() )
{
QMutexLocker lock( &s_mutex );
if ( s_queries.contains( id() ) )
{
s_queries.remove( id() );
@ -206,7 +206,9 @@ Query::refreshResults()
if ( m_resolveFinished )
{
m_resolveFinished = false;
Pipeline::instance()->resolve( s_queries.value( id() ) );
QMutexLocker lock( &s_mutex );
if ( s_queries.contains( id() ) && !s_queries[ id() ].isNull() )
Pipeline::instance()->resolve( s_queries.value( id() ) );
}
}