mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 14:56:36 +00:00
padtemplate: Create pad templates with floating refs
And take ownership of the floating ref in gst_element_add_pad_template()
This commit is contained in:
parent
dd89e924db
commit
be00534878
3 changed files with 6 additions and 14 deletions
|
@ -98,6 +98,9 @@ The 0.11 porting guide
|
|||
|
||||
gst_pad_template_new() does not take ownership of the caps anymore.
|
||||
|
||||
GstPadTemplate is now created with a floating ref and
|
||||
gst_element_class_add_pad_template() takes ownership of this floating ref.
|
||||
|
||||
* GstMiniObject
|
||||
A miniobject is now a simple refcounted structure holding the information
|
||||
common to buffers, events, messages, queries and caps.
|
||||
|
|
|
@ -1297,6 +1297,9 @@ gst_element_class_add_pad_template (GstElementClass * klass,
|
|||
template_list = g_list_next (template_list);
|
||||
}
|
||||
|
||||
/* Take ownership of the floating ref */
|
||||
g_object_ref_sink (templ);
|
||||
|
||||
klass->padtemplates = g_list_append (klass->padtemplates, templ);
|
||||
klass->numpadtemplates++;
|
||||
}
|
||||
|
|
|
@ -219,20 +219,6 @@ gst_pad_template_class_init (GstPadTemplateClass * klass)
|
|||
static void
|
||||
gst_pad_template_init (GstPadTemplate * templ)
|
||||
{
|
||||
/* FIXME 0.11: Does anybody remember why this is here? If not, let's
|
||||
* change it for 0.11 and let gst_element_class_add_pad_template() for
|
||||
* example ref/sink the pad templates.
|
||||
*/
|
||||
/* We ensure that the pad template we're creating has a sunken reference.
|
||||
* Inconsistencies in pad templates being floating or sunken has caused
|
||||
* problems in the past with leaks, etc.
|
||||
*
|
||||
* For consistency, then, we only produce them with sunken references
|
||||
* owned by the creator of the object
|
||||
*/
|
||||
if (g_object_is_floating (templ)) {
|
||||
gst_object_ref_sink (templ);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Reference in a new issue