From: Sebastian Dröge Date: Tue, 17 May 2011 10:10:27 +0000 (+0200) Subject: padtemplate: Create pad templates with floating refs X-Git-Tag: RELEASE-0.11.0~290 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=be00534878a091adccc731788f33295075d07ca6;p=platform%2Fupstream%2Fgstreamer.git padtemplate: Create pad templates with floating refs And take ownership of the floating ref in gst_element_add_pad_template() --- diff --git a/docs/random/porting-to-0.11.txt b/docs/random/porting-to-0.11.txt index 0a3099e..eb8eeea 100644 --- a/docs/random/porting-to-0.11.txt +++ b/docs/random/porting-to-0.11.txt @@ -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. diff --git a/gst/gstelement.c b/gst/gstelement.c index a047cf4..f8afa3d 100644 --- a/gst/gstelement.c +++ b/gst/gstelement.c @@ -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++; } diff --git a/gst/gstpadtemplate.c b/gst/gstpadtemplate.c index e5a57ff..e6c8c0b 100644 --- a/gst/gstpadtemplate.c +++ b/gst/gstpadtemplate.c @@ -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