Details

[Home]

Issue of the Implementation # D0071

Brief

Dynamic parent class is not finalized during g_type_class_unref() call

Detailed Description

Consider the following simple hierarchy: a parent dynamic class and a single dynamic descendant from it. Whenever the descendant is referenced and then immediately unreferenced, the parent dynamic class does not get finalized.

Problem location(s) in the standard

Linux Standard Base Desktop Specification 3.1, Chapter 12. Libraries, 12.5.1 glib-2.0/glib-object.h that refers http://www.gtk.org/api/2.6/gobject/gobject-Type-Information.html#g-type-class-unref

Reproducing

  1. Consider dummy implementation of GTypePlugin interface, which does nothing, but sets the value of 'GTypeInfo *info' output parameter of the methods g_type_plugin_complete_type_info()' and 'g_type_plugin_complete_interface_info()', based on the value of passed in type ids.
  2. Also simple hierarchy of types is implemented:
    • Static fundamental "GTTPFSet" class.
    • Direct dynamic descendant of "GTTPFSet" - "GTTPDynSet" class.
    • Direct dynamic descendant of "GTTPDynSet" - "GTTPDynList" class, also implementing dynamic "GTTPIDynList" interface.
  3. All three dynamic types are explicitly registered via
    "g_type_register_dynamic()", using the same instance of GTypePlugin
    implementation from P.1.
  4. The class "GTTPDynList" is referenced once and then immediately
    unreferenced.
The test scenario, reproducing the bug can be downloaded from here.

Possible solutions

Debugging against Glib-GObject v.2.6.5 sources shows that during initialization of "GTTPDynList" descendant class, it's dynamic parent "GTTPDynSet" gets referenced twice. Possible solution may be eliminating this by adding some kind of "just_initialized" flag.

Component

gtk-gobject 2.6.2 or later

Accepted

Gnome Bugzilla 520094

[Home]