From 88282d4f0520579285335c9c55b54192916489a9 Mon Sep 17 00:00:00 2001 From: David Schleef Date: Sun, 13 Jul 2003 19:15:30 +0000 Subject: [PATCH] add warning if getcaps function returns an unreferenced caps Original commit message from CVS: add warning if getcaps function returns an unreferenced caps --- gst/gstpad.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gst/gstpad.c b/gst/gstpad.c index bcd60f5..45d3694 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -1833,8 +1833,13 @@ gst_pad_get_caps (GstPad *pad) return GST_PAD_CAPS (realpad); } else if GST_RPAD_GETCAPSFUNC (realpad) { + GstCaps *caps; + GST_CAT_DEBUG (GST_CAT_CAPS, "using pad get function"); - return GST_RPAD_GETCAPSFUNC (realpad) (GST_PAD_CAST (realpad), NULL); + caps = GST_RPAD_GETCAPSFUNC (realpad) (GST_PAD_CAST (realpad), NULL); + if(caps)g_return_val_if_fail(caps->refcount > 0, NULL); + + return caps; } else if (GST_PAD_PAD_TEMPLATE (realpad)) { GstPadTemplate *templ = GST_PAD_PAD_TEMPLATE (realpad); -- 2.7.4