From: Michael Smith Date: Thu, 6 Apr 2006 15:07:12 +0000 (+0000) Subject: gst/gstpad.c: Use g_value_get_object() instead of g_value_dup_gst_object(), to avoid... X-Git-Tag: RELEASE-0_10_5~25 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6c40c7595e92676399566d5dfb2c774e779f1a25;p=platform%2Fupstream%2Fgstreamer.git gst/gstpad.c: Use g_value_get_object() instead of g_value_dup_gst_object(), to avoid double-reffing the pad template ... Original commit message from CVS: * gst/gstpad.c: (gst_pad_set_property): Use g_value_get_object() instead of g_value_dup_gst_object(), to avoid double-reffing the pad template (which we then sink, so this worked previously if (and only if) the pad template was floating. * gst/gstpadtemplate.c: (gst_pad_template_init), (gst_pad_template_pad_created): Never return floating references to pad templates, create them as initially-sunken. Document an extra function (and make this stop sinking our pad template, since that is now guaranteed to do nothing, since we created it sunken). * gst/gstghostpad.c: Fix docs typo. --- diff --git a/ChangeLog b/ChangeLog index 8ce0bb6..b3be097 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +2006-04-06 Michael Smith + + * gst/gstpad.c: (gst_pad_set_property): + Use g_value_get_object() instead of g_value_dup_gst_object(), + to avoid double-reffing the pad template (which we then sink, + so this worked previously if (and only if) the pad template + was floating. + + * gst/gstpadtemplate.c: (gst_pad_template_init), + (gst_pad_template_pad_created): + Never return floating references to pad templates, create + them as initially-sunken. + + Document an extra function (and make this stop sinking our + pad template, since that is now guaranteed to do nothing, + since we created it sunken). + + * gst/gstghostpad.c: + Fix docs typo. + 2006-04-06 Tim-Philipp Müller * gst/gstinfo.c: (__gst_in_valgrind): diff --git a/common b/common index 623fe1c..1783855 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 623fe1c2cce45bc30d5823c05716349874ae994e +Subproject commit 1783855e983a5294434673694e8a57e44980b6f1 diff --git a/gst/gstghostpad.c b/gst/gstghostpad.c index f50d988..a1ed937 100644 --- a/gst/gstghostpad.c +++ b/gst/gstghostpad.c @@ -36,7 +36,7 @@ * If the target pad is known at creation time, gst_ghost_pad_new() is the * function to use to get a ghost-pad. Otherwise one can use gst_ghost_pad_new_no_target() * to create the ghost-pad and use gst_ghost_pad_set_target() to establish the - * accociation later on. + * association later on. * * Last reviewed on 2005-11-18 (0.9.5) */ diff --git a/gst/gstpad.c b/gst/gstpad.c index 7eb604d..c78992e 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -421,7 +421,7 @@ gst_pad_set_property (GObject * object, guint prop_id, break; case PAD_PROP_TEMPLATE: gst_pad_set_pad_template (GST_PAD_CAST (object), - (GstPadTemplate *) g_value_dup_gst_object (value)); + (GstPadTemplate *) g_value_get_object (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); diff --git a/gst/gstpadtemplate.c b/gst/gstpadtemplate.c index 348107b..9c81665 100644 --- a/gst/gstpadtemplate.c +++ b/gst/gstpadtemplate.c @@ -119,7 +119,8 @@ static GstObject *parent_class = NULL; static guint gst_pad_template_signals[LAST_SIGNAL] = { 0 }; static void gst_pad_template_class_init (GstPadTemplateClass * klass); -static void gst_pad_template_init (GstPadTemplate * templ); +static void gst_pad_template_init (GstPadTemplate * templ, + GstPadTemplateClass * klass); static void gst_pad_template_dispose (GObject * object); GType @@ -172,8 +173,19 @@ gst_pad_template_class_init (GstPadTemplateClass * klass) } static void -gst_pad_template_init (GstPadTemplate * templ) +gst_pad_template_init (GstPadTemplate * templ, GstPadTemplateClass * klass) { + /* 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 (GST_OBJECT_IS_FLOATING (templ)) { + gst_object_ref (templ); + gst_object_sink (templ); + } } static void @@ -346,10 +358,16 @@ gst_pad_template_get_caps (GstPadTemplate * templ) return GST_PAD_TEMPLATE_CAPS (templ); } +/** + * gst_pad_template_pad_created: + * @templ: a #GstPadTemplate that has been created + * @pad: the #GstPad that created it + * + * Emit the pad-created signal for this template when created by this pad. + */ void gst_pad_template_pad_created (GstPadTemplate * templ, GstPad * pad) { - gst_object_sink (GST_OBJECT (templ)); g_signal_emit (G_OBJECT (templ), gst_pad_template_signals[TEMPL_PAD_CREATED], 0, pad); }