[couchdb-glib] Make couchdb_session_free_document_list know what to free
- From: Rodrigo Moya <rodrigo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [couchdb-glib] Make couchdb_session_free_document_list know what to free
- Date: Tue, 4 May 2010 16:29:03 +0000 (UTC)
commit a48fe0c4f7a2048011b8b0c1b6348340fd2f6650
Author: Rodrigo Moya <rodrigo gnome-db org>
Date: Tue May 4 18:28:53 2010 +0200
Make couchdb_session_free_document_list know what to free
couchdb-glib/couchdb-session.c | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/couchdb-glib/couchdb-session.c b/couchdb-glib/couchdb-session.c
index 41292a0..dbe36f5 100644
--- a/couchdb-glib/couchdb-session.c
+++ b/couchdb-glib/couchdb-session.c
@@ -638,8 +638,16 @@ couchdb_session_free_document_list (GSList *doclist)
{
g_return_if_fail (doclist != NULL);
- g_slist_foreach (doclist, (GFunc) couchdb_document_info_unref, NULL);
- g_slist_free (doclist);
+ while (doclist != NULL) {
+ gpointer data = doclist->data;
+
+ doclist = g_slist_remove (doclist, data);
+
+ if (COUCHDB_IS_DOCUMENT (data))
+ g_object_unref (G_OBJECT (data));
+ else
+ couchdb_document_info_unref (data);
+ }
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]