From 858de9793c789a9feb36b5c849afae23835c9622 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Thu, 31 Aug 2006 17:13:34 +0000 Subject: [PATCH] gst/gstutils.c: Ensure that we set a capsfilter to NULL if we failed to link it when doing filtered linking, to avoid... Original commit message from CVS: * gst/gstutils.c: (gst_element_link_pads), (gst_element_link_pads_filtered): Ensure that we set a capsfilter to NULL if we failed to link it when doing filtered linking, to avoid criticals. No need to check for unreffing srcpad, which is explicly NULLed above (a trivial code cleanup). --- ChangeLog | 10 ++++++++++ gst/gstutils.c | 8 ++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 088c5eb685..2649607974 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2006-08-31 Michael Smith + + * gst/gstutils.c: (gst_element_link_pads), + (gst_element_link_pads_filtered): + Ensure that we set a capsfilter to NULL if we failed to link it + when doing filtered linking, to avoid criticals. + + No need to check for unreffing srcpad, which is explicly NULLed + above (a trivial code cleanup). + 2006-08-31 Wim Taymans * docs/design/part-gstghostpad.txt: diff --git a/gst/gstutils.c b/gst/gstutils.c index bb11f6d9c7..2fe1a8ff6e 100644 --- a/gst/gstutils.c +++ b/gst/gstutils.c @@ -1482,13 +1482,8 @@ gst_element_link_pads (GstElement * src, const gchar * srcpadname, GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "no link possible from %s to %s:%s", GST_ELEMENT_NAME (src), GST_DEBUG_PAD_NAME (destpad)); gst_object_unref (destpad); - if (srcpad) - gst_object_unref (srcpad); return FALSE; } else { - if (srcpad) - gst_object_unref (srcpad); - srcpad = NULL; if (destpad) gst_object_unref (destpad); destpad = NULL; @@ -1598,8 +1593,9 @@ gst_element_link_pads_filtered (GstElement * src, const gchar * srcpadname, return TRUE; } else { GST_INFO ("Could not link elements"); + gst_element_set_state (capsfilter, GST_STATE_NULL); + /* this will unlink and unref as appropriate */ gst_bin_remove (GST_BIN (GST_OBJECT_PARENT (capsfilter)), capsfilter); - /* will unref and unlink as appropriate */ return FALSE; } } else {