[rhythmbox] audiocd: remove action group from UI manager when disposing (bug 597706)



commit 4dcbd0caa14a1ee0a7e4750db9b330b496eb175d
Author: Jonathan Matthew <jonathan d14n org>
Date:   Sat Oct 10 11:03:21 2009 +1000

    audiocd: remove action group from UI manager when disposing (bug 597706)
    
    The action group previously was not removed from the UI manager.  This
    meant that the 'reload' action remained, with a pointer to the old
    (disposed) source object as the user data.  Removing it from the UI
    manager when disposing one source causes the action to be recreated when
    creating a new source, so it'll have the right user data.

 plugins/audiocd/rb-audiocd-source.c |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/plugins/audiocd/rb-audiocd-source.c b/plugins/audiocd/rb-audiocd-source.c
index 20ebf18..53a3641 100644
--- a/plugins/audiocd/rb-audiocd-source.c
+++ b/plugins/audiocd/rb-audiocd-source.c
@@ -204,10 +204,6 @@ rb_audiocd_source_finalize (GObject *object)
 	g_free (priv->device_path);
 
 #ifdef HAVE_SJ_METADATA_GETTER
-	if (priv->action_group != NULL) {
-		g_object_unref (priv->action_group);
-		priv->action_group = NULL;
-	}
 	g_free (priv->submit_url);
 	priv->submit_url = NULL;
 #endif
@@ -225,6 +221,18 @@ rb_audiocd_source_dispose (GObject *object)
 {
 	RBAudioCdSourcePrivate *priv = AUDIOCD_SOURCE_GET_PRIVATE (object);
 
+#ifdef HAVE_SJ_METADATA_GETTER
+	if (priv->action_group != NULL) {
+		GtkUIManager *uimanager;
+		g_object_get (object, "ui-manager", &uimanager, NULL);
+		gtk_ui_manager_remove_action_group (uimanager, priv->action_group);
+		g_object_unref (uimanager);
+
+		g_object_unref (priv->action_group);
+		priv->action_group = NULL;
+	}
+#endif
+
 	if (priv->pipeline) {
 		gst_object_unref (GST_OBJECT (priv->pipeline));
 		priv->pipeline = NULL;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]