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

Move Q_D underneath any thread guards

This commit is contained in:
Dominik Schmidt 2014-11-13 20:10:20 +01:00
parent 0c26533261
commit 84b30f0f5e

View File

@ -102,14 +102,14 @@ JSInfoPlugin::notInCacheSlot( Tomahawk::InfoSystem::InfoStringHash criteria, Tom
void
JSInfoPlugin::addInfoRequestResult( int requestId, qint64 maxAge, const QVariantMap& returnedData )
{
Q_D( JSInfoPlugin );
if ( QThread::currentThread() != thread() )
{
QMetaObject::invokeMethod( this, "addInfoRequestResult", Qt::QueuedConnection, Q_ARG( int, requestId ), Q_ARG( qint64, maxAge ), Q_ARG( QVariantMap, returnedData ) );
return;
}
Q_D( JSInfoPlugin );
// retrieve requestData from cache and delete it
Tomahawk::InfoSystem::InfoRequestData requestData = d->requestDataCache[ requestId ];
d->requestDataCache.remove( requestId );
@ -127,14 +127,15 @@ JSInfoPlugin::addInfoRequestResult( int requestId, qint64 maxAge, const QVariant
void
JSInfoPlugin::emitGetCachedInfo( int requestId, const QVariantMap& criteria, int newMaxAge )
{
Q_D( JSInfoPlugin );
if ( QThread::currentThread() != thread() )
{
QMetaObject::invokeMethod( this, "emitGetCachedInfo", Qt::QueuedConnection, Q_ARG( int, requestId ), Q_ARG( QVariantMap, criteria ), Q_ARG( int, newMaxAge ) );
return;
}
Q_D( JSInfoPlugin );
emit getCachedInfo( convertQVariantMapToInfoStringHash( criteria ), newMaxAge, d->requestDataCache[ requestId ]);
}
@ -142,14 +143,14 @@ JSInfoPlugin::emitGetCachedInfo( int requestId, const QVariantMap& criteria, int
void
JSInfoPlugin::emitInfo( int requestId, const QVariantMap& output )
{
Q_D( JSInfoPlugin );
if ( QThread::currentThread() != thread() )
{
QMetaObject::invokeMethod( this, "emitInfo", Qt::QueuedConnection, Q_ARG( int, requestId ), Q_ARG( QVariantMap, output ) );
return;
}
Q_D( JSInfoPlugin );
emit info( d->requestDataCache[ requestId ], output );
}