From 2faf93c009d866d68cf0d063a29bb8c21f192aea Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 13 Nov 2018 14:32:56 +0200 Subject: [PATCH] harness: Take ownership of floating references (pads, elements) passed to the harness Without this bindings get confused about the meaning of references, and we really own these references if they are not already owned by something else. --- libs/gst/check/gstharness.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libs/gst/check/gstharness.c b/libs/gst/check/gstharness.c index c0f4467..ba3b3c1 100644 --- a/libs/gst/check/gstharness.c +++ b/libs/gst/check/gstharness.c @@ -550,6 +550,7 @@ gst_harness_setup_src_pad (GstHarness * h, /* sending pad */ h->srcpad = gst_pad_new_from_static_template (src_tmpl, "src"); g_assert (h->srcpad); + gst_object_ref_sink (h->srcpad); g_object_set_data (G_OBJECT (h->srcpad), HARNESS_KEY, h); gst_pad_set_query_function (h->srcpad, gst_harness_src_query); @@ -577,6 +578,7 @@ gst_harness_setup_sink_pad (GstHarness * h, /* receiving pad */ h->sinkpad = gst_pad_new_from_static_template (sink_tmpl, "sink"); g_assert (h->sinkpad); + gst_object_ref_sink (h->sinkpad); g_object_set_data (G_OBJECT (h->sinkpad), HARNESS_KEY, h); gst_pad_set_chain_function (h->sinkpad, gst_harness_chain); @@ -687,7 +689,7 @@ gst_harness_new_empty (void) /** * gst_harness_add_element_full: (skip) * @h: a #GstHarness - * @element: a #GstElement to add to the harness (transfer none) + * @element (transfer floating): a #GstElement to add to the harness * @hsrc: (allow-none): a #GstStaticPadTemplate describing the harness srcpad. * %NULL will not create a harness srcpad. * @element_sinkpad_name: (allow-none): a #gchar with the name of the element @@ -718,7 +720,7 @@ gst_harness_add_element_full (GstHarness * h, GstElement * element, g_return_if_fail (h->element == NULL); element_clock = GST_ELEMENT_CLOCK (element); - h->element = gst_object_ref (element); + h->element = gst_object_ref_sink (element); check_element_type (element, &has_sinkpad, &has_srcpad); /* setup the loose srcpad linked to the element sinkpad */ @@ -768,7 +770,7 @@ gst_harness_add_element_full (GstHarness * h, GstElement * element, /** * gst_harness_new_full: (skip) - * @element: a #GstElement to attach the harness to (transfer none) + * @element: (transfer floating): a #GstElement to attach the harness to * @hsrc: (allow-none): a #GstStaticPadTemplate describing the harness srcpad. * %NULL will not create a harness srcpad. * @element_sinkpad_name: (allow-none): a #gchar with the name of the element @@ -804,7 +806,7 @@ gst_harness_new_full (GstElement * element, /** * gst_harness_new_with_element: (skip) - * @element: a #GstElement to attach the harness to (transfer none) + * @element: (transfer floating): a #GstElement to attach the harness to * @element_sinkpad_name: (allow-none): a #gchar with the name of the element * sinkpad that is then linked to the harness srcpad. %NULL does not attach a * sinkpad -- 2.7.4