From f51f5e4d596f1538ce8b043323646f6febd43296 Mon Sep 17 00:00:00 2001
From: Leo Franchi <lfranchi@kde.org>
Date: Mon, 9 Apr 2012 22:20:49 -0400
Subject: [PATCH] remove associated actions when deleting spotify account

---
 src/accounts/spotify/SpotifyAccount.cpp | 7 +++++++
 src/accounts/spotify/SpotifyAccount.h   | 2 +-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/accounts/spotify/SpotifyAccount.cpp b/src/accounts/spotify/SpotifyAccount.cpp
index 0a5d72a2e..13522d3ea 100644
--- a/src/accounts/spotify/SpotifyAccount.cpp
+++ b/src/accounts/spotify/SpotifyAccount.cpp
@@ -82,6 +82,13 @@ SpotifyAccount::SpotifyAccount( const QString& accountId, const QString& path )
 }
 
 
+SpotifyAccount::~SpotifyAccount()
+{
+    foreach( QAction* action, m_customActions )
+        ActionCollection::instance()->removeAction( action );
+}
+
+
 void
 SpotifyAccount::init()
 {
diff --git a/src/accounts/spotify/SpotifyAccount.h b/src/accounts/spotify/SpotifyAccount.h
index 1489ac47b..01dbad3fd 100644
--- a/src/accounts/spotify/SpotifyAccount.h
+++ b/src/accounts/spotify/SpotifyAccount.h
@@ -77,7 +77,7 @@ class SpotifyAccount : public ResolverAccount
 public:
     SpotifyAccount( const QString& accountId );
     SpotifyAccount( const QString& accountId, const QString& path );
-    virtual ~SpotifyAccount() {}
+    virtual ~SpotifyAccount();
 
     virtual QPixmap icon() const;
     virtual QWidget* configurationWidget();