1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-13 20:39:57 +01:00

Make sure to call spotifyaccount in main thread

This commit is contained in:
Leo Franchi 2012-07-18 17:17:09 -04:00
parent 14457750ff
commit 3f9046d61d
2 changed files with 12 additions and 11 deletions

View File

@ -133,16 +133,18 @@ SpotifyPlaylistUpdater::remove( bool askToDeletePlaylist )
void
SpotifyPlaylistUpdater::aboutToDelete()
{
if ( m_subscribed )
if ( QThread::currentThread() != QApplication::instance()->thread() )
QMetaObject::invokeMethod( const_cast<SpotifyPlaylistUpdater*>(this), "aboutToDelete", Qt::BlockingQueuedConnection );
else
{
m_spotify.data()->setSubscribedForPlaylist( playlist(), false );
}
else if ( m_sync )
{
if ( QThread::currentThread() != QApplication::instance()->thread() )
QMetaObject::invokeMethod( const_cast<SpotifyPlaylistUpdater*>(this), "checkDeleteDialog", Qt::BlockingQueuedConnection );
else
checkDeleteDialog();
if ( m_subscribed )
{
m_spotify.data()->setSubscribedForPlaylist( playlist(), false );
}
else if ( m_sync )
{
checkDeleteDialog();
}
}
}

View File

@ -72,9 +72,8 @@ public slots:
void tomahawkTracksMoved( const QList<Tomahawk::plentry_ptr>& ,int );
void tomahawkPlaylistRenamed( const QString&, const QString& );
protected:
void aboutToDelete();
private slots:
// SpotifyResolver message handlers, all take msgtype, msg as argument
void onTracksInsertedReturn( const QString& msgType, const QVariantMap& msg, const QVariant& extraData );