1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-07-31 11:20:22 +02:00

* Fixed Source method being run in the wrong thread.

This commit is contained in:
Christian Muehlhaeuser
2012-03-07 04:45:32 +01:00
parent 89009c09be
commit 6552deca61
2 changed files with 7 additions and 2 deletions

View File

@@ -350,6 +350,12 @@ Source::trackTimerFired()
void void
Source::addCommand( const QSharedPointer<DatabaseCommand>& command ) Source::addCommand( const QSharedPointer<DatabaseCommand>& command )
{ {
if ( QThread::currentThread() != thread() )
{
QMetaObject::invokeMethod( this, "addCommand", Qt::QueuedConnection, Q_ARG( const QSharedPointer<DatabaseCommand>, command ) );
return;
}
m_cmds << command; m_cmds << command;
if ( !command->singletonCmd() ) if ( !command->singletonCmd() )
m_lastCmdGuid = command->guid(); m_lastCmdGuid = command->guid();
@@ -363,7 +369,6 @@ Source::executeCommands()
{ {
if ( QThread::currentThread() != thread() ) if ( QThread::currentThread() != thread() )
{ {
tDebug() << "Reinvoking in correct thread:" << Q_FUNC_INFO;
QMetaObject::invokeMethod( this, "executeCommands", Qt::QueuedConnection ); QMetaObject::invokeMethod( this, "executeCommands", Qt::QueuedConnection );
return; return;
} }

View File

@@ -129,9 +129,9 @@ private slots:
void trackTimerFired(); void trackTimerFired();
void executeCommands(); void executeCommands();
void addCommand( const QSharedPointer<DatabaseCommand>& command );
private: private:
void addCommand( const QSharedPointer<DatabaseCommand>& command );
void updateTracks(); void updateTracks();
void reportSocialAttributesChanged( DatabaseCommand_SocialAction* action ); void reportSocialAttributesChanged( DatabaseCommand_SocialAction* action );