mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 14:16:32 +02: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:
@@ -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,6 +206,8 @@ Query::refreshResults()
|
||||
if ( m_resolveFinished )
|
||||
{
|
||||
m_resolveFinished = false;
|
||||
QMutexLocker lock( &s_mutex );
|
||||
if ( s_queries.contains( id() ) && !s_queries[ id() ].isNull() )
|
||||
Pipeline::instance()->resolve( s_queries.value( id() ) );
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user