[libgdata] Bug 618586 — gdata_service_query_single_entry() encounters NULL type class



commit ac5100204516070296d0f54a5d3622ef06edbc13
Author: Philip Withnall <philip tecnocode co uk>
Date:   Mon Jun 14 17:00:14 2010 +0100

    Bug 618586 â?? gdata_service_query_single_entry() encounters NULL type class
    
    Fix a crasher when using gdata_service_query_single_entry() with a type class
    which hasn't previously been initialised. Based on a patch by Richard
    Schwarting <aquarichy gmail com>. Closes: bgo#618586

 gdata/gdata-service.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/gdata/gdata-service.c b/gdata/gdata-service.c
index 08f403d..50fb651 100644
--- a/gdata/gdata-service.c
+++ b/gdata/gdata-service.c
@@ -1280,19 +1280,22 @@ gdata_service_query_single_entry (GDataService *self, const gchar *entry_id, GDa
 	g_return_val_if_fail (error == NULL || *error == NULL, NULL);
 
 	/* Query for just the specified entry */
-	klass = GDATA_ENTRY_CLASS (g_type_class_peek_static (entry_type));
+	klass = GDATA_ENTRY_CLASS (g_type_class_ref (entry_type));
 	g_assert (klass->get_entry_uri != NULL);
 
 	entry_uri = klass->get_entry_uri (entry_id);
 	message = _gdata_service_query (GDATA_SERVICE (self), entry_uri, query, cancellable, error);
 	g_free (entry_uri);
 
-	if (message == NULL)
+	if (message == NULL) {
+		g_type_class_unref (klass);
 		return NULL;
+	}
 
 	g_assert (message->response_body->data != NULL);
 	entry = GDATA_ENTRY (gdata_parsable_new_from_xml (entry_type, message->response_body->data, message->response_body->length, error));
 	g_object_unref (message);
+	g_type_class_unref (klass);
 
 	return entry;
 }



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