[rhythmbox] add some missing rhythmdb_entry_unref calls



commit 684e36c91ba76a9ab7ae97ba5e23cd4d7dfa1f98
Author: Jonathan Matthew <jonathan d14n org>
Date:   Fri Mar 19 22:02:12 2010 +1000

    add some missing rhythmdb_entry_unref calls
    
    rhythmdb_query_model_iter_to_entry *does* ref the entry it returns after
    all.

 plugins/audiocd/rb-audiocd-source.c                |    1 +
 .../rb-generic-player-playlist-source.c            |    2 ++
 plugins/ipod/rb-ipod-source.c                      |    1 +
 podcast/rb-podcast-manager.c                       |   14 ++++++++++----
 rhythmdb/rhythmdb-property-model.c                 |    1 +
 5 files changed, 15 insertions(+), 4 deletions(-)
---
diff --git a/plugins/audiocd/rb-audiocd-source.c b/plugins/audiocd/rb-audiocd-source.c
index f907259..b8b2a40 100644
--- a/plugins/audiocd/rb-audiocd-source.c
+++ b/plugins/audiocd/rb-audiocd-source.c
@@ -1375,6 +1375,7 @@ set_extract (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer
 		extra_data->extract = GPOINTER_TO_INT (data);
 
 		gtk_tree_model_row_changed (GTK_TREE_MODEL (model), path, iter);
+		rhythmdb_entry_unref (entry);
 	}
 	return FALSE;
 }
diff --git a/plugins/generic-player/rb-generic-player-playlist-source.c b/plugins/generic-player/rb-generic-player-playlist-source.c
index 705d754..2c0ec4e 100644
--- a/plugins/generic-player/rb-generic-player-playlist-source.c
+++ b/plugins/generic-player/rb-generic-player-playlist-source.c
@@ -121,6 +121,7 @@ save_playlist_foreach (GtkTreeModel *model,
 	set_field_from_property (data->playlist, &pl_iter, entry, RHYTHMDB_PROP_GENRE, TOTEM_PL_PARSER_FIELD_GENRE);
 	set_field_from_property (data->playlist, &pl_iter, entry, RHYTHMDB_PROP_ALBUM, TOTEM_PL_PARSER_FIELD_ALBUM);
 	set_field_from_property (data->playlist, &pl_iter, entry, RHYTHMDB_PROP_TITLE, TOTEM_PL_PARSER_FIELD_TITLE);
+	rhythmdb_entry_unref (entry);
 
 	g_free (uri);
 	return FALSE;
@@ -148,6 +149,7 @@ save_playlist_entry (GtkTreeModel *model, GtkTreeIter *iter,
 	*uri = rb_generic_player_source_uri_to_playlist_uri (priv->player_source, host_uri, data->playlist_type);
 	*title = rhythmdb_entry_dup_string (entry, RHYTHMDB_PROP_TITLE);
 	*custom_title = TRUE;
+	rhythmdb_entry_unref (entry);
 }
 
 #endif
diff --git a/plugins/ipod/rb-ipod-source.c b/plugins/ipod/rb-ipod-source.c
index 9110310..ffddd78 100644
--- a/plugins/ipod/rb-ipod-source.c
+++ b/plugins/ipod/rb-ipod-source.c
@@ -1177,6 +1177,7 @@ rb_add_artwork_whole_album_cb (GtkTreeModel *query_model,
 	entry = rhythmdb_query_model_iter_to_entry (RHYTHMDB_QUERY_MODEL (query_model), iter);
 
 	song = g_hash_table_lookup (artwork_data->priv->entry_map, entry);
+	rhythmdb_entry_unref (entry);
 	g_return_val_if_fail (song != NULL, FALSE);
 
 	if (song->has_artwork == 0x01) {		   
diff --git a/podcast/rb-podcast-manager.c b/podcast/rb-podcast-manager.c
index d31a3a6..ff36a01 100644
--- a/podcast/rb-podcast-manager.c
+++ b/podcast/rb-podcast-manager.c
@@ -1778,10 +1778,14 @@ remove_if_not_downloaded (GtkTreeModel *model,
 
 	entry = rhythmdb_query_model_iter_to_entry (RHYTHMDB_QUERY_MODEL (model),
 						    iter);
-	if (entry != NULL && rb_podcast_manager_entry_downloaded (entry) == FALSE) {
-		rb_debug ("entry %s is no longer present in the feed and has not been downloaded",
-			  get_remote_location (entry));
-		*remove = g_list_prepend (*remove, entry);
+	if (entry != NULL) {
+		if (rb_podcast_manager_entry_downloaded (entry) == FALSE) {
+			rb_debug ("entry %s is no longer present in the feed and has not been downloaded",
+				  get_remote_location (entry));
+			*remove = g_list_prepend (*remove, entry);
+		} else {
+			rhythmdb_entry_unref (entry);
+		}
 	}
 
 	return FALSE;
@@ -1926,8 +1930,10 @@ rb_podcast_manager_insert_feed (RBPodcastManager *pd, RBPodcastChannel *data)
 				do {
 					entry = rhythmdb_query_model_iter_to_entry (existing_entries, &iter);
 					if (strcmp (get_remote_location (entry), item->url) == 0) {
+						rhythmdb_entry_unref (entry);
 						break;
 					}
+					rhythmdb_entry_unref (entry);
 					entry = NULL;
 
 				} while (gtk_tree_model_iter_next (GTK_TREE_MODEL (existing_entries), &iter));
diff --git a/rhythmdb/rhythmdb-property-model.c b/rhythmdb/rhythmdb-property-model.c
index e50a376..6b6f6d4 100644
--- a/rhythmdb/rhythmdb-property-model.c
+++ b/rhythmdb/rhythmdb-property-model.c
@@ -339,6 +339,7 @@ _remove_entry_cb (GtkTreeModel *model,
 	rhythmdb_property_model_entry_removed_cb (RHYTHMDB_QUERY_MODEL (model),
 						  entry,
 						  propmodel);
+	rhythmdb_entry_unref (entry);
 	return FALSE;
 }
 



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