GNOME Bugzilla – Bug 765540
gst_element_base_class_finalize() is never called
Last modified: 2016-06-04 12:35:47 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
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.
(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
So add a patch using the flag here? :)
Shouldn't we also remove this dead code as it's never going to be called anyway? Or at least document it?
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