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 520094 - Dynamic parent class is not finalized during g_type_class_unref() call
Dynamic parent class is not finalized during g_type_class_unref() call
Product: glib
Classification: Platform
Component: gobject
Other Linux
: Normal normal
: ---
Assigned To: Tim Janik
Depends on:
Reported: 2008-03-03 13:28 UTC by Areg Beketovski
Modified: 2017-11-07 11:58 UTC
See Also:
GNOME target: ---
GNOME version: ---

Test scenario reproducing the issue. (10.00 KB, application/x-gzip)
2008-03-03 13:32 UTC, Areg Beketovski

Description Areg Beketovski 2008-03-03 13:28:22 UTC
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.

Steps to reproduce:
   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

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.
Comment 1 Areg Beketovski 2008-03-03 13:30:22 UTC
The detailed bug description can be found at:
Comment 2 Areg Beketovski 2008-03-03 13:32:00 UTC
Created attachment 106469 [details]
Test scenario reproducing the issue.
Comment 3 Tim Janik 2008-08-18 13:08:43 UTC
(In reply to comment #2)
> Created an attachment (id=106469) [edit]
> Test scenario reproducing the issue.

Hm, do you think you could produce a single .c test file in glib coding style from this that we could integrate into our test suite?
Comment 4 Matthias Clasen 2008-11-30 23:52:34 UTC
Looks similar to bug 350200, which has a proposed fix.
Comment 5 Tim Janik 2017-11-07 11:58:49 UTC
Closing this very dated report, feel free to reopen if it comes up again.