[rhythmbox] ext-db: clean up more references added during signal returns



commit 5b281f50f5cd325dae99c078a09795db67484bb5
Author: Jonathan Matthew <jonathan d14n org>
Date:   Wed Jun 13 19:15:40 2012 +1000

    ext-db: clean up more references added during signal returns
    
    More huge leaks.

 metadata/rb-ext-db.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/metadata/rb-ext-db.c b/metadata/rb-ext-db.c
index bd23bfc..d53c257 100644
--- a/metadata/rb-ext-db.c
+++ b/metadata/rb-ext-db.c
@@ -865,12 +865,23 @@ do_store_request (GSimpleAsyncResult *result, GObject *object, GCancellable *can
 		 */
 		g_signal_emit (store, signals[LOAD], 0, req->data, &req->value);
 		rb_debug ("converted encoded data into value of type %s", G_VALUE_TYPE_NAME (req->value));
+
+		/* drop extra ref added by signal return */
+		if (G_VALUE_HOLDS (req->data, G_TYPE_OBJECT)) {
+			g_object_unref (g_value_get_object (req->data));
+		}
 	} else if (req->value != NULL) {
 		/* we got an object representing the data; store it so we
 		 * can write it to a file
 		 */
 		g_signal_emit (store, signals[STORE], 0, req->value, &req->data);
+
 		rb_debug ("stored value into encoded data of type %s", G_VALUE_TYPE_NAME (req->data));
+
+		/* drop extra ref added by signal return */
+		if (G_VALUE_HOLDS (req->data, G_TYPE_OBJECT)) {
+			g_object_unref (g_value_get_object (req->data));
+		}
 	} else {
 		/* indicates we actually didn't get anything, as opposed to communication errors etc.
 		 * providers just shouldn't call rb_ext_db_store_* in that case.



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