From c9917a1a842cd8b2583dfe45677ddc5bd5f40432 Mon Sep 17 00:00:00 2001 From: Stefan Kost Date: Wed, 8 Apr 2009 17:49:18 +0300 Subject: [PATCH] tests: remove the hacks to workaround the pad-leak --- gst/gstutils.c | 5 ----- tests/check/gst/gstghostpad.c | 26 ++++++++------------------ tests/check/gst/gstpad.c | 13 ------------- 3 files changed, 8 insertions(+), 36 deletions(-) diff --git a/gst/gstutils.c b/gst/gstutils.c index 56be79d550..1b2c070f70 100644 --- a/gst/gstutils.c +++ b/gst/gstutils.c @@ -945,11 +945,6 @@ gst_element_get_compatible_pad (GstElement * element, GstPad * pad, templ = gst_pad_template_new ((gchar *) GST_PAD_NAME (pad), GST_PAD_DIRECTION (pad), GST_PAD_ALWAYS, templcaps); - /* FIXME : Because of a bug in gst_pad_template_new() by which is does not - * properly steal the refcount of the given caps, we have to unref these caps - * REVERT THIS WHEN FIXED !*/ - gst_caps_unref (templcaps); - foundpad = gst_element_request_compatible_pad (element, templ); gst_object_unref (templ); diff --git a/tests/check/gst/gstghostpad.c b/tests/check/gst/gstghostpad.c index 3db738019e..08529cabe4 100644 --- a/tests/check/gst/gstghostpad.c +++ b/tests/check/gst/gstghostpad.c @@ -612,13 +612,6 @@ GST_START_TEST (test_ghost_pads_new_from_template) ghosttempl = gst_pad_template_new ("ghosttempl", GST_PAD_SINK, GST_PAD_ALWAYS, ghostcaps); - /* FIXME : We should not have to unref those caps, but due to - * a bug in gst_pad_template_new() not stealing the refcount of - * the given caps we have to. */ - gst_caps_unref (ghostcaps); - gst_caps_unref (copypadcaps); - - sinkpad = gst_pad_new_from_template (padtempl, "sinkpad"); fail_unless (sinkpad != NULL); @@ -665,12 +658,6 @@ GST_START_TEST (test_ghost_pads_new_no_target_from_template) ghosttempl = gst_pad_template_new ("ghosttempl", GST_PAD_SINK, GST_PAD_ALWAYS, copyghostcaps); - /* FIXME : We should not have to unref those caps, but due to - * a bug in gst_pad_template_new() not stealing the refcount of - * the given caps we have to. */ - gst_caps_unref (copyghostcaps); - gst_caps_unref (copypadcaps); - sinkpad = gst_pad_new_from_template (padtempl, "sinkpad"); fail_unless (sinkpad != NULL); @@ -723,9 +710,10 @@ GST_START_TEST (test_ghost_pads_forward_setcaps) templ_caps = gst_caps_from_string ("meh; muh"); src_template = gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, templ_caps); + + templ_caps = gst_caps_from_string ("muh; meh"); sink_template = gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, templ_caps); - gst_caps_unref (templ_caps); src = gst_pad_new_from_template (src_template, "src"); sink = gst_pad_new_from_template (sink_template, "sink"); @@ -851,12 +839,13 @@ GST_START_TEST (test_ghost_pads_sink_link_unlink) padcaps = gst_caps_from_string ("some/caps"); fail_unless (padcaps != NULL); - srctempl = gst_pad_template_new ("srctempl", GST_PAD_SRC, GST_PAD_ALWAYS, padcaps); + + padcaps = gst_caps_from_string ("some/caps"); + fail_unless (padcaps != NULL); sinktempl = gst_pad_template_new ("sinktempl", GST_PAD_SINK, GST_PAD_ALWAYS, padcaps); - gst_caps_unref (padcaps); srcpad = gst_pad_new_from_template (srctempl, "src"); fail_unless (srcpad != NULL); @@ -922,12 +911,13 @@ GST_START_TEST (test_ghost_pads_src_link_unlink) padcaps = gst_caps_from_string ("some/caps"); fail_unless (padcaps != NULL); - srctempl = gst_pad_template_new ("srctempl", GST_PAD_SRC, GST_PAD_ALWAYS, padcaps); + + padcaps = gst_caps_from_string ("some/caps"); + fail_unless (padcaps != NULL); sinktempl = gst_pad_template_new ("sinktempl", GST_PAD_SINK, GST_PAD_ALWAYS, padcaps); - gst_caps_unref (padcaps); srcpad = gst_pad_new_from_template (srctempl, "src"); fail_unless (srcpad != NULL); diff --git a/tests/check/gst/gstpad.c b/tests/check/gst/gstpad.c index 19d7a79a82..2c40379622 100644 --- a/tests/check/gst/gstpad.c +++ b/tests/check/gst/gstpad.c @@ -208,10 +208,6 @@ name_is_valid (const gchar * name, GstPadPresence presence) new = gst_pad_template_new (name, GST_PAD_SRC, presence, any); if (new) { gst_object_unref (GST_OBJECT (new)); - /* FIXME : We should not have to unref those caps, but due to - * a bug in gst_pad_template_new() not stealing the refcount of - * the given caps we have to. */ - gst_caps_unref (any); return TRUE; } return FALSE; @@ -482,11 +478,6 @@ GST_START_TEST (test_push_negotiation) GST_PAD_ALWAYS, srccaps); sink_template = gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, sinkcaps); - /* FIXME : We should not have to unref those caps, but due to - * a bug in gst_pad_template_new() not stealing the refcount of - * the given caps we have to. */ - gst_caps_unref (srccaps); - gst_caps_unref (sinkcaps); sink = gst_pad_new_from_template (sink_template, "sink"); fail_if (sink == NULL); @@ -603,10 +594,6 @@ GST_START_TEST (test_get_caps_must_be_copy) caps = gst_caps_new_any (); templ = gst_pad_template_new ("test_templ", GST_PAD_SRC, GST_PAD_ALWAYS, caps); - /* FIXME : This is not correct behaviour, but due to a bug with - * gst_pad_template_new() not stealing the refcount of the given caps, - * we need to unref it */ - gst_caps_unref (caps); pad = gst_pad_new_from_template (templ, NULL); fail_unless (GST_PAD_CAPS (pad) == NULL, "caps present on pad");