From 6552deca612f32d08a955ee4fc2d316518c0764b Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Wed, 7 Mar 2012 04:45:32 +0100 Subject: [PATCH] * Fixed Source method being run in the wrong thread. --- src/libtomahawk/source.cpp | 7 ++++++- src/libtomahawk/source.h | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/libtomahawk/source.cpp b/src/libtomahawk/source.cpp index 9d96792db..ebf795a08 100644 --- a/src/libtomahawk/source.cpp +++ b/src/libtomahawk/source.cpp @@ -350,6 +350,12 @@ Source::trackTimerFired() void Source::addCommand( const QSharedPointer& command ) { + if ( QThread::currentThread() != thread() ) + { + QMetaObject::invokeMethod( this, "addCommand", Qt::QueuedConnection, Q_ARG( const QSharedPointer, command ) ); + return; + } + m_cmds << command; if ( !command->singletonCmd() ) m_lastCmdGuid = command->guid(); @@ -363,7 +369,6 @@ Source::executeCommands() { if ( QThread::currentThread() != thread() ) { - tDebug() << "Reinvoking in correct thread:" << Q_FUNC_INFO; QMetaObject::invokeMethod( this, "executeCommands", Qt::QueuedConnection ); return; } diff --git a/src/libtomahawk/source.h b/src/libtomahawk/source.h index f3361a720..396094c0e 100644 --- a/src/libtomahawk/source.h +++ b/src/libtomahawk/source.h @@ -129,9 +129,9 @@ private slots: void trackTimerFired(); void executeCommands(); + void addCommand( const QSharedPointer& command ); private: - void addCommand( const QSharedPointer& command ); void updateTracks(); void reportSocialAttributesChanged( DatabaseCommand_SocialAction* action );