1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-22 21:54:00 +02: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 void
SpotifyPlaylistUpdater::aboutToDelete() 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 ); if ( m_subscribed )
} {
else if ( m_sync ) m_spotify.data()->setSubscribedForPlaylist( playlist(), false );
{ }
if ( QThread::currentThread() != QApplication::instance()->thread() ) else if ( m_sync )
QMetaObject::invokeMethod( const_cast<SpotifyPlaylistUpdater*>(this), "checkDeleteDialog", Qt::BlockingQueuedConnection ); {
else checkDeleteDialog();
checkDeleteDialog(); }
} }
} }

View File

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