[gstreamer-bugs] [Bug 491501] Reduce usage of base_init in GstElement subclasses

GStreamer (bugzilla.gnome.org) bugzilla-daemon at bugzilla.gnome.org
Mon Jan 28 07:11:59 PST 2008


If you have any questions why you received this email, please see the text at
the end of this email. Replies to this email are NOT read, please see the text
at the end of this email. You can add comments to this bug at:
  http://bugzilla.gnome.org/show_bug.cgi?id=491501

  GStreamer | gstreamer (core) | Ver: HEAD CVS




------- Comment #22 from Sebastian Dröge  2008-01-28 15:11 UTC -------
I'm currently working on a unit test for the pad templates, including a test
for adding a pad template with the same name twice for the same class in
class_init.
This unfortunately creates a memory leak currently for an unknown reason.

add_pad_template() will reference the added pad template (and did this since
forever) and if a pad template with the same name is already found the old one
is unreferenced and the new one referenced. This shouldn't leak the first added
pad IF the old behaviour was correct already.

But the pad template that is given to add_pad_template() is never unreferenced
by any caller I looked at so the question is: Who called the second _unref()
before?

Now, when we remove the _ref() from add_pad_template() there is still no memory
leak and no double _unref() which makes things even more mysterious.

Is there any reason WHY we call _ref() in add_pad_template() and WHY no caller
of add_pad_template() calls _unref() on the pad template afterwards but still
no memory is leaked? :)

Also, WHY don't we call gst_object_sink() after the _ref()? Shouldn't this be
done to remove the FLOATING flag?

/me is confused :)

As I understand it we should _ref() and _sink() in _add_pad_template() and this
should fix all confusion but would still be nice if someone understands the
current behaviour.


-- 
See http://bugzilla.gnome.org/page.cgi?id=email.html for more info about why you received
this email, why you can't respond via email, how to stop receiving
emails (or reduce the number you receive), and how to contact someone
if you are having problems with the system.

You can add comments to this bug at http://bugzilla.gnome.org/show_bug.cgi?id=491501.




More information about the Gstreamer-bugs mailing list