[rhythmbox] grilo: fix reference counting



commit 03c7fd8ad66e675ae5129315723cff05d959adca
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Wed Sep 19 01:04:35 2012 +0200

    grilo: fix reference counting
    
    The sources hash table in the plugin wants to take ownership of the key and
    the value, but the key is owned by the GrlRegistry and the value is a GtkWidget
    and thus floating. Fix that by referencing both before adding them to the
    hash table.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=684333

 plugins/grilo/rb-grilo-plugin.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/plugins/grilo/rb-grilo-plugin.c b/plugins/grilo/rb-grilo-plugin.c
index 19aa7c5..11ecc19 100644
--- a/plugins/grilo/rb-grilo-plugin.c
+++ b/plugins/grilo/rb-grilo-plugin.c
@@ -137,7 +137,7 @@ grilo_source_added_cb (GrlRegistry *registry, GrlSource *grilo_source, RBGriloPl
 	rb_debug ("new grilo source: %s", grl_source_get_name (grilo_source));
 
 	source = rb_grilo_source_new (G_OBJECT (plugin), grilo_source);
-	g_hash_table_insert (plugin->sources, grilo_source, source);
+	g_hash_table_insert (plugin->sources, g_object_ref (grilo_source), g_object_ref_sink (source));
 
 	/* probably put some sources under 'shared', some under 'stores'? */
 	g_object_get (plugin, "object", &shell, NULL);



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