After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 651271 - Generator cannot produce { "a" : {} }
Generator cannot produce { "a" : {} }
Status: RESOLVED FIXED
Product: json-glib
Classification: Core
Component: Generator
0.12.x
Other Linux
: High critical
: ---
Assigned To: json-glib-maint
json-glib-maint
: 677156 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2011-05-27 17:26 UTC by Marcin Lewandowski
Modified: 2012-05-31 22:34 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Marcin Lewandowski 2011-05-27 17:26:08 UTC
When I try to generate something like this

{ "a" : {} }

I got segfault.

My code:

  JsonBuilder    *builder;
  JsonGenerator  *generator;
  gchar          *json = NULL;

    builder = json_builder_new();

    json_builder_begin_object(builder);

    json_builder_set_member_name (builder, "a");
    json_builder_begin_object(builder);
    json_builder_end_object(builder);


    json_builder_end_object(builder);

    generator = json_generator_new();
    json_generator_set_root(generator, json_builder_get_root(builder));
    json = json_generator_to_data(generator, NULL);


I use the following version from ubuntu 11.04:

libjson-glib-1.0-0                    0.12.2-0ubuntu1
Comment 1 Emmanuele Bassi (:ebassi) 2011-05-28 10:20:47 UTC
Thanks for taking the time to report this bug.
Without a stack trace from the crash it's very hard to determine what caused it.
Can you get us a stack trace? Please see http://live.gnome.org/GettingTraces for more information on how to do so. Thanks in advance!
Comment 2 Emmanuele Bassi (:ebassi) 2011-05-28 10:39:54 UTC
I added a test case and was able to reproduce a segfault.

the issue has been fixed in master, and will be backported to the stable branch.

thanks for reporting this bug.
Comment 3 André Klapper 2012-03-13 22:08:31 UTC
[Fixing Default QA assignee for json-glib - see 613232#c1. Sorry for bugmail noise.]
Comment 4 Emmanuele Bassi (:ebassi) 2012-05-31 22:34:18 UTC
*** Bug 677156 has been marked as a duplicate of this bug. ***