From f9baff11c86c7b4645b5d6a39dec6d1f9dc4bac4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Cr=C3=AAte?= Date: Fri, 20 Feb 2015 16:22:23 -0500 Subject: [PATCH] Revert "element: set pads need-parent flag to false when removing" This reverts commit 1911554cff2c4a11772b541a8215a80c728b1097. This breaks the functionality of GST_PAD_FLAG_NEED_PARENT, the reason for this flag is that if a pad is removed from a running element, you don't want functions (such as chain or event) to be called on the pad without a parent set. This can happen if you remove a request or sometimes pad from a running element. I don't see the code that caused this in tsdemux, but if it needs to unset the flag on remove, it should do it itself and then make sure that the parent exists in any pad function. --- gst/gstelement.c | 1 - tests/check/gst/gstelement.c | 35 ----------------------------------- 2 files changed, 36 deletions(-) diff --git a/gst/gstelement.c b/gst/gstelement.c index 81655a3bb3..ae3999058c 100644 --- a/gst/gstelement.c +++ b/gst/gstelement.c @@ -795,7 +795,6 @@ gst_element_remove_pad (GstElement * element, GstPad * pad) break; } element->pads = g_list_remove (element->pads, pad); - GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_NEED_PARENT); element->numpads--; element->pads_cookie++; GST_OBJECT_UNLOCK (element); diff --git a/tests/check/gst/gstelement.c b/tests/check/gst/gstelement.c index faa95a5901..8732611b78 100644 --- a/tests/check/gst/gstelement.c +++ b/tests/check/gst/gstelement.c @@ -50,40 +50,6 @@ GST_START_TEST (test_add_remove_pad) GST_END_TEST; - -GST_START_TEST (test_add_remove_readd_pad) -{ - GstElement *e; - GstPad *p; - - /* getting an existing element class is cheating, but easier */ - e = gst_element_factory_make ("fakesrc", "source"); - - /* create a new floating pad with refcount 1 */ - p = gst_pad_new ("source", GST_PAD_SRC); - - gst_object_ref (p); - - /* simulate a real scenario where the pad is activated before added */ - fail_unless (gst_pad_set_active (p, TRUE)); - gst_element_add_pad (e, p); - - /* now remove and deactivate it */ - fail_unless (gst_pad_set_active (p, FALSE)); - gst_element_remove_pad (e, p); - - /* should be able to reuse the same pad */ - fail_unless (gst_pad_set_active (p, TRUE)); - fail_unless (gst_element_add_pad (e, p)); - - /* clean up our own reference */ - gst_object_unref (p); - gst_object_unref (e); -} - -GST_END_TEST; - - GST_START_TEST (test_add_pad_unref_element) { GstElement *e; @@ -389,7 +355,6 @@ gst_element_suite (void) suite_add_tcase (s, tc_chain); tcase_add_test (tc_chain, test_add_remove_pad); - tcase_add_test (tc_chain, test_add_remove_readd_pad); tcase_add_test (tc_chain, test_add_pad_unref_element); tcase_add_test (tc_chain, test_error_no_bus); tcase_add_test (tc_chain, test_link);