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 765540 - gst_element_base_class_finalize() is never called
gst_element_base_class_finalize() is never called
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other Linux
: Normal enhancement
: 1.9.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-04-25 13:54 UTC by Guillaume Desmottes
Modified: 2016-06-04 12:35 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Guillaume Desmottes 2016-04-25 13:54:44 UTC
gst_element_base_class_finalize() is defined as a GTypeInfo.base_finalize but those functions are actually never called with static types. That means it will never be called for any GstElement subclass.
That's too bad because this function is supposed to unref GstPadTemplate which are actually leaked.

It's not the end of the world but it clutter test results when tracking leaks  using tools like valgrind, GST_TRACE or my refcount tracer (bug #765052). It also makes it harder/impossible to rely on such tools to implement automatic leaks regression tests.

I'm not sure of the proper way to address this. One option could be to track class creations in gst_element_base_class_init(), store them in a static list and manually destroy them with a specific API called from gst_deinit(). It's a bit hacky and not the cleanness but that should do the job I think
Comment 1 Sebastian Dröge (slomo) 2016-04-25 15:49:22 UTC
I'd rather teach your tools to ignore objects that are intentionally "leaked". They are not actually leaked, it's not much different from all those static allocations in GLib and elsewhere in GStreamer.
Comment 2 Guillaume Desmottes 2016-05-04 21:30:41 UTC
(In reply to Sebastian Dröge (slomo) from comment #1)
> I'd rather teach your tools to ignore objects that are intentionally
> "leaked". They are not actually leaked, it's not much different from all
> those static allocations in GLib and elsewhere in GStreamer.

See bug #766008
Comment 3 Sebastian Dröge (slomo) 2016-05-15 10:08:41 UTC
So add a patch using the flag here? :)
Comment 4 Guillaume Desmottes 2016-05-16 08:12:06 UTC
Shouldn't we also remove this dead code as it's never going to be called anyway? Or at least document it?
Comment 5 Tim-Philipp Müller 2016-06-04 12:35:47 UTC
commit 56b92900739c82019faaa7d75540c69db45b57aa
Author: Tim-Philipp Müller <tim@centricular.com>
Date:   Sat Jun 4 13:31:58 2016 +0100

    deviceprovider: remove base_class_finalize function
    
    It's not going to get called anyway.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=765540

commit 38c74e41c7a1957e6fcb19b105a58d8c0196025c
Author: Tim-Philipp Müller <tim@centricular.com>
Date:   Sat Jun 4 13:11:55 2016 +0100

    element: remove base_class_finalize_func which is never called
    
    Won't be called for static types, so no point keeping it around.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=765540