[0.11] gstreamer: element: don't crash on missing template

Wim Taymans wtay at kemper.freedesktop.org
Tue Jan 31 07:30:26 PST 2012


Module: gstreamer
Branch: 0.11
Commit: 76a60c4c421bec86a13575b4949a4e630cd7993f
URL:    http://cgit.freedesktop.org/gstreamer/gstreamer/commit/?id=76a60c4c421bec86a13575b4949a4e630cd7993f

Author: Wim Taymans <wim.taymans at collabora.co.uk>
Date:   Tue Jan 31 16:27:55 2012 +0100

element: don't crash on missing template

Some request pads don't have a padtemplate (mostly those from encodebin). Avoid
crashing in this case.

---

 gst/gstelement.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/gst/gstelement.c b/gst/gstelement.c
index 30c73f2..de0b9f7 100644
--- a/gst/gstelement.c
+++ b/gst/gstelement.c
@@ -316,8 +316,9 @@ gst_element_release_request_pad (GstElement * element, GstPad * pad)
 
   g_return_if_fail (GST_IS_ELEMENT (element));
   g_return_if_fail (GST_IS_PAD (pad));
-  g_return_if_fail (GST_PAD_TEMPLATE_PRESENCE (GST_PAD_PAD_TEMPLATE (pad))
-      == GST_PAD_REQUEST);
+  g_return_if_fail (GST_PAD_PAD_TEMPLATE (pad) == NULL ||
+      GST_PAD_TEMPLATE_PRESENCE (GST_PAD_PAD_TEMPLATE (pad)) ==
+      GST_PAD_REQUEST);
 
   oclass = GST_ELEMENT_GET_CLASS (element);
 



More information about the gstreamer-commits mailing list