From f9956b4eadcfc9bbd5c0bc4b861ff782779e8a9a Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Tue, 14 Apr 2009 00:09:35 +0100 Subject: [node] Do not overwrite when copying Bug 1353 - Copying JSON_NODE_VALUE nodes unreliable at best When copying a JsonNode to another we do an implicit memcpy using: *copy = *src Which works well enough with pointers, but makes a mess out of the value-based nodes. We should just copy the type of the original JsonNode and leave the rest to the switch() block. In order to catch potential regressions, we also need a more thorough test unit for the JsonNode copy operation. --- json-glib/json-node.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'json-glib/json-node.c') diff --git a/json-glib/json-node.c b/json-glib/json-node.c index b0f6bef..7043de3 100644 --- a/json-glib/json-node.c +++ b/json-glib/json-node.c @@ -131,7 +131,7 @@ json_node_copy (JsonNode *node) g_return_val_if_fail (node != NULL, NULL); copy = g_slice_new0 (JsonNode); - *copy = *node; + copy->type = node->type; switch (copy->type) { -- cgit v1.2.1