From 029dd935c99e0bf09135592c10bf80fd6ebac344 Mon Sep 17 00:00:00 2001
From: Leo Franchi <lfranchi@kde.org>
Date: Mon, 30 Apr 2012 22:43:12 -0400
Subject: [PATCH] Unregister updater from playlist on deletion

---
 src/libtomahawk/playlist/PlaylistUpdaterInterface.cpp | 7 +++++++
 src/libtomahawk/playlist/PlaylistUpdaterInterface.h   | 2 +-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/libtomahawk/playlist/PlaylistUpdaterInterface.cpp b/src/libtomahawk/playlist/PlaylistUpdaterInterface.cpp
index 700001227..e5eb35d6d 100644
--- a/src/libtomahawk/playlist/PlaylistUpdaterInterface.cpp
+++ b/src/libtomahawk/playlist/PlaylistUpdaterInterface.cpp
@@ -70,6 +70,13 @@ PlaylistUpdaterInterface::PlaylistUpdaterInterface( const playlist_ptr& pl )
 }
 
 
+PlaylistUpdaterInterface::~PlaylistUpdaterInterface()
+{
+    if ( !m_playlist.isNull() )
+        m_playlist->removeUpdater( this );
+}
+
+
 void
 PlaylistUpdaterInterface::save()
 {
diff --git a/src/libtomahawk/playlist/PlaylistUpdaterInterface.h b/src/libtomahawk/playlist/PlaylistUpdaterInterface.h
index 6ea530a2a..3cdac7397 100644
--- a/src/libtomahawk/playlist/PlaylistUpdaterInterface.h
+++ b/src/libtomahawk/playlist/PlaylistUpdaterInterface.h
@@ -56,7 +56,7 @@ public:
 
     explicit PlaylistUpdaterInterface( const playlist_ptr& pl );
 
-    virtual ~PlaylistUpdaterInterface(){}
+    virtual ~PlaylistUpdaterInterface();
 
     // What type you are. If you add a new updater, add the creation code as well.
     virtual QString type() const = 0;