From 1de237a502ceee96df7091c2df4492b8bc08b2c5 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Sat, 7 Nov 2015 17:38:22 +0100 Subject: node: Add json_node_ref() and json_node_unref() Add reference counting semantics to JsonNode, in addition to the existing init/unset and alloc/free semantics. json_node_free() must only be used with nodes allocated using json_node_alloc(). json_node_unref() may be used with all nodes (if correctly paired; it may be paired with json_node_alloc()). It is not valid to call json_node_free() on a node whose reference count is not 1. https://bugzilla.gnome.org/show_bug.cgi?id=756121 --- json-glib/json-object.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'json-glib/json-object.c') diff --git a/json-glib/json-object.c b/json-glib/json-object.c index 574d04d..acb72f7 100644 --- a/json-glib/json-object.c +++ b/json-glib/json-object.c @@ -66,7 +66,7 @@ json_object_new (void) object->ref_count = 1; object->members = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, - (GDestroyNotify) json_node_free); + (GDestroyNotify) json_node_unref); object->members_ordered = NULL; return object; @@ -525,7 +525,7 @@ json_object_get_values (JsonObject *object) * inside a #JsonObject * * Return value: (transfer full): a copy of the node for the requested - * object member or %NULL. Use json_node_free() when done. + * object member or %NULL. Use json_node_unref() when done. * * Since: 0.6 */ -- cgit v1.2.1