GNOME Bugzilla – Bug 473705
Param spec pool only initialized with GObject Class
Last modified: 2008-11-29 03:23:14 UTC
Please describe the problem: The param spec pool is only initialized with the GObject class. As properties are available on GTypeInterface it is possible to cause a critical error by attempting to access interface properties before param spec pool has been initialized. Steps to reproduce: Build the following code and run the program. #include <glib-object.h> GType test_interface_get_type(void) { static GType type = 0; if (type == 0) { static const GTypeInfo info = { sizeof (GTypeInterface), NULL, /* base_init */ NULL, /* base_finalize */ NULL, /* class_init */ NULL, /* class_finalize */ NULL, /* class_data */ 0, 0, /* n_preallocs */ NULL /* instance_init */ }; type = g_type_register_static (G_TYPE_INTERFACE, "TestInterface", &info, 0); } return type; } int main(int argc, char *argv[]) { GType interface; gint num; g_type_init(); interface = test_interface_get_type(); /*g_type_class_ref(G_TYPE_OBJECT);*/ g_object_interface_list_properties(g_type_default_interface_ref(interface), &num); } Actual results: Without the call to g_type_class_ref the following error is seen: (process:1451): GLib-GObject-CRITICAL **: g_param_spec_pool_list: assertion `pool != NULL' failed Expected results: Does this happen every time? Yes Other information: This problem was initially seen in the PyGtk code generation tool defsgen.py. Bug 473576
this stops gtk-doc from working when documenting stuff that uses the gobject typesystem but doesn't subclass gobject (like libraries containing only interfaces...)
Just as a note, the gtk-doc breakage can be worked around by using --type-init-func="g_type_init();g_type_class_ref(G_TYPE_OBJECT)" with gtkdoc-scangobj
*** This bug has been marked as a duplicate of 465631 ***