[couchdb-glib] Create json_object in couchdb_document_init, so that subclasses get it
- From: Rodrigo Moya <rodrigo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [couchdb-glib] Create json_object in couchdb_document_init, so that subclasses get it
- Date: Wed, 7 Jul 2010 09:19:44 +0000 (UTC)
commit 52d9f93b8e9bd19ade281b05f30e7c4138476794
Author: Rodrigo Moya <rodrigo gnome-db org>
Date: Wed Jul 7 11:19:34 2010 +0200
Create json_object in couchdb_document_init, so that subclasses get it
couchdb-glib/couchdb-document.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/couchdb-glib/couchdb-document.c b/couchdb-glib/couchdb-document.c
index 5aa098d..84667a0 100644
--- a/couchdb-glib/couchdb-document.c
+++ b/couchdb-glib/couchdb-document.c
@@ -117,6 +117,7 @@ static void
couchdb_document_init (CouchdbDocument *document)
{
document->priv = g_new0 (CouchdbDocumentPrivate, 1);
+ document->priv->root_object = json_object_new ();
}
/**
@@ -134,8 +135,6 @@ couchdb_document_new (void)
document = g_object_new (COUCHDB_TYPE_DOCUMENT, NULL);
- document->priv->root_object = json_object_new ();
-
return document;
}
@@ -146,6 +145,9 @@ couchdb_document_new_from_json_object (JsonObject *json_object)
document = g_object_new (COUCHDB_TYPE_DOCUMENT, NULL);
+ if (document->priv->root_object != NULL)
+ json_object_unref (document->priv->root_object);
+
document->priv->root_object = json_object_ref (json_object);
return document;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]