GNOME Bugzilla – Bug 520094
Dynamic parent class is not finalized during g_type_class_unref() call
Last modified: 2017-11-07 11:58:49 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.
The detailed bug description can be found at:
Created attachment 106469 [details]
Test scenario reproducing the issue.
(In reply to comment #2)
> Created an attachment (id=106469) 
> 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?
Looks similar to bug 350200, which has a proposed fix.
Closing this very dated report, feel free to reopen if it comes up again.