Revert "element: set pads need-parent flag to false when removing"
authorOlivier Crête <olivier.crete@collabora.com>
Fri, 20 Feb 2015 21:22:23 +0000 (16:22 -0500)
committerOlivier Crête <olivier.crete@collabora.com>
Fri, 20 Feb 2015 21:22:23 +0000 (16:22 -0500)
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
tests/check/gst/gstelement.c

index 81655a3..ae39990 100644 (file)
@@ -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);
index faa95a5..8732611 100644 (file)
@@ -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);