GNOME Bugzilla – Bug 642383
Mem corruption when using set_*member twice without a remove
Last modified: 2012-03-13 22:08:21 UTC
Created attachment 180897 [details] Test source Running the attached program results in this output, even though according to the docs everything should be fine: ** (process:9352): DEBUG: test-json-set.vala:19: { "member" : "foo" } (process:9352): Json-CRITICAL **: json_node_get_node_type: assertion `node != NULL' failed ** (process:9352): DEBUG: test-json-set.vala:22: { "\xa8\xae.\xca\u0001\u007f" : null }
an odd result is that if I change the g_debug() to: json_object_set_string_member (obj, "member", "foo"); g_assert (strcmp (json_object_get_string_member (obj, "member"), "foo") == 0); json_object_set_string_member (obj, "member", "bar"); g_assert (strcmp (json_object_get_string_member (obj, "member"), "bar") == 0); the test passes without triggering any assertion. so it looks like it's not a problem of JsonObject or JsonNode, but a problem somewhere in JsonGenerator.
This problem has been fixed in our software repository. The fix will go into the next software release. Thank you for your bug report.
[Fixing Default QA assignee for json-glib - see 613232#c1. Sorry for bugmail noise.]