Dynamic parent class finalization



Hi All,

I am working on the LSB conformance test suite, preparing test scenarios for the GObject library. Recently I have encountered an issue, which is not clearly stated in the GObject documentation and I would greatly appreciate if someone could explain me if this is some kind of hidden feature or a bug. In short, if I define a parent dynamic class and a single descendant from it, if the descendant is referenced and immediately unreferenced, the parent dynamic class does not get finalized.

Here what is done.
1. Consider some kind of dummy implementation of GTypePlugin interface, which does nothing, but sets the value of 'GTypeInfo *info' 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 prepared
    a) Static fundamental "GTTPFSet" class.
    b) Direct descendant of "GTTPFSet" - "GTTPDynSet" class.
c) Direct 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.

According to the trace from "class_init/class_finalize" callbacks both "GTTPDynList" and "GTTPIDynList" get fully finalized, but the "GTTPDynSet" (parent dynamic class for "GTTPDynList") does not! I have also debugged against the sources of Glib-GObject v.2.6.5 and it shows that during initialization of "GTTPDynList" descendant class, it's dynamic parent "GTTPDynSet" gets referenced twice. I am wondering now if this functionality is implemented intentionally, or the base class should have had some kind of "just_initialized" flag, not to get referenced twice?.

The sample source code, reproducing this issue is attached.


  Thanks and Regards,
     Areg Beketovski


Linux Verification Center, ISPRAS, RAU
web:    http://www.linuxtesting.org
e-mail: abeketovski linuxtesting org

Attachment: gobject_dynamic_test.tar.gz
Description: GNU Zip compressed data



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]