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

* Make Source::addCommand synchronous again, so we can rely on m_lastCmdGuid being set.

This commit is contained in:
Christian Muehlhaeuser 2012-06-20 19:34:51 +02:00
parent faf6374967
commit 056213bc27
2 changed files with 14 additions and 7 deletions

View File

@ -408,14 +408,18 @@ Source::trackTimerFired()
}
QString
Source::lastCmdGuid() const
{
QMutexLocker lock( &m_cmdMutex );
return m_lastCmdGuid;
}
void
Source::addCommand( const QSharedPointer<DatabaseCommand>& command )
{
if ( QThread::currentThread() != thread() )
{
QMetaObject::invokeMethod( this, "addCommand", Qt::QueuedConnection, Q_ARG( const QSharedPointer<DatabaseCommand>, command ) );
return;
}
QMutexLocker lock( &m_cmdMutex );
m_cmds << command;
if ( !command->singletonCmd() )
@ -434,6 +438,8 @@ Source::executeCommands()
return;
}
QMutexLocker lock( &m_cmdMutex );
if ( !m_cmds.isEmpty() )
{
QList< QSharedPointer<DatabaseCommand> > cmdGroup;

View File

@ -117,7 +117,7 @@ public slots:
private slots:
void dbLoaded( unsigned int id, const QString& fname );
QString lastCmdGuid() const { return m_lastCmdGuid; }
QString lastCmdGuid() const;
void updateIndexWhenSynced();
void setOffline();
@ -138,7 +138,6 @@ private:
QList< QSharedPointer<Collection> > m_collections;
QVariantMap m_stats;
QString m_lastCmdGuid;
bool m_isLocal;
bool m_online;
@ -157,6 +156,8 @@ private:
ControlConnection* m_cc;
QList< QSharedPointer<DatabaseCommand> > m_cmds;
int m_commandCount;
QString m_lastCmdGuid;
mutable QMutex m_cmdMutex;
mutable QPixmap* m_avatar;
mutable QPixmap* m_fancyAvatar;