1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-07 14:46:33 +02:00

don't delete a playlist if we don't have an updater for it or if it's already deleted

This commit is contained in:
Leo Franchi
2012-04-08 16:11:43 -04:00
parent a80929e52f
commit 1a6f96caaf
3 changed files with 14 additions and 2 deletions

View File

@@ -384,6 +384,13 @@ SpotifyAccount::registerUpdaterForPlaylist( const QString& plId, SpotifyPlaylist
} }
void
SpotifyAccount::unregisterUpdater( const QString& plid )
{
m_updaters.remove( plid );
}
void void
SpotifyAccount::fetchFullPlaylist( SpotifyPlaylistInfo* playlist ) SpotifyAccount::fetchFullPlaylist( SpotifyPlaylistInfo* playlist )
{ {
@@ -406,7 +413,7 @@ SpotifyAccount::stopPlaylistSync( SpotifyPlaylistInfo* playlist )
m_spotifyResolver.data()->sendMessage( msg ); m_spotifyResolver.data()->sendMessage( msg );
if ( deleteOnUnsync() ) if ( deleteOnUnsync() && m_updaters.contains( playlist->plid ) )
{ {
SpotifyPlaylistUpdater* updater = m_updaters.take( playlist->plid ); SpotifyPlaylistUpdater* updater = m_updaters.take( playlist->plid );
playlist_ptr tomahawkPl = updater->playlist(); playlist_ptr tomahawkPl = updater->playlist();

View File

@@ -86,7 +86,9 @@ public:
virtual SipPlugin* sipPlugin() { return 0; } virtual SipPlugin* sipPlugin() { return 0; }
void sendMessage( const QVariantMap& msg, QObject* receiver, const QString& slot ); void sendMessage( const QVariantMap& msg, QObject* receiver, const QString& slot );
void registerUpdaterForPlaylist( const QString& plId, SpotifyPlaylistUpdater* updater ); void registerUpdaterForPlaylist( const QString& plId, SpotifyPlaylistUpdater* updater );
void unregisterUpdater( const QString& plid );
bool deleteOnUnsync() const; bool deleteOnUnsync() const;
private slots: private slots:

View File

@@ -85,7 +85,10 @@ SpotifyPlaylistUpdater::init()
SpotifyPlaylistUpdater::~SpotifyPlaylistUpdater() SpotifyPlaylistUpdater::~SpotifyPlaylistUpdater()
{ {
if ( !m_spotify.isNull() )
{
m_spotify.data()->unregisterUpdater( m_spotifyId );
}
} }