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 473705 - Param spec pool only initialized with GObject Class
Param spec pool only initialized with GObject Class
Status: RESOLVED DUPLICATE of bug 465631
Product: glib
Classification: Platform
Component: gobject
2.14.x
Other All
: Normal normal
: ---
Assigned To: Tim Janik
gtkdev
Depends on:
Blocks:
 
 
Reported: 2007-09-04 21:25 UTC by Mark Doffman
Modified: 2008-11-29 03:23 UTC
See Also:
GNOME target: ---
GNOME version: 2.17/2.18



Description Mark Doffman 2007-09-04 21:25:05 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
Comment 1 Allison Karlitskaya (desrt) 2007-09-23 22:33:21 UTC
this stops gtk-doc from working when documenting stuff that uses the gobject typesystem but doesn't subclass gobject (like libraries containing only interfaces...)
Comment 2 Chris Lord 2007-09-25 23:35:54 UTC
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
Comment 3 Matthias Clasen 2008-11-29 03:23:14 UTC

*** This bug has been marked as a duplicate of 465631 ***