mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-03 15:06:34 +00:00
fix bug in _dispose of element/pads
Original commit message from CVS: fix bug in _dispose of element/pads
This commit is contained in:
parent
49ae4007af
commit
9e1fa5e574
2 changed files with 19 additions and 8 deletions
|
@ -328,8 +328,15 @@ gst_element_remove_pad (GstElement *element, GstPad *pad)
|
|||
g_return_if_fail (GST_IS_PAD (pad));
|
||||
|
||||
g_return_if_fail (GST_PAD_PARENT (pad) == element);
|
||||
|
||||
/* add it to the list */
|
||||
/* check to see if the pad is still connected */
|
||||
/* FIXME: what if someone calls _remove_pad instead of
|
||||
_remove_ghost_pad? */
|
||||
if (GST_IS_REAL_PAD (pad))
|
||||
{
|
||||
g_return_if_fail (GST_RPAD_PEER (pad) == NULL);
|
||||
}
|
||||
|
||||
/* remove it from the list */
|
||||
element->pads = g_list_remove (element->pads, pad);
|
||||
element->numpads--;
|
||||
if (gst_pad_get_direction (pad) == GST_PAD_SRC)
|
||||
|
@ -1188,7 +1195,12 @@ gst_element_dispose (GObject *object)
|
|||
orig = pads = g_list_copy (element->pads);
|
||||
while (pads) {
|
||||
pad = GST_PAD (pads->data);
|
||||
gst_object_destroy (GST_OBJECT (pad));
|
||||
if (GST_PAD_PEER (pad))
|
||||
{
|
||||
GST_DEBUG (GST_CAT_REFCOUNTING, "disconnecting pad '%s'\n",GST_OBJECT_NAME(GST_OBJECT (GST_PAD (GST_PAD_PEER (pad)))));
|
||||
gst_pad_disconnect (pad, GST_PAD (GST_PAD_PEER (pad)));
|
||||
}
|
||||
gst_element_remove_pad (element, pad);
|
||||
pads = g_list_next (pads);
|
||||
}
|
||||
g_list_free (orig);
|
||||
|
|
|
@ -1427,6 +1427,10 @@ gst_real_pad_dispose (GObject *object)
|
|||
{
|
||||
GstPad *pad = GST_PAD (object);
|
||||
|
||||
/* No connected pad can ever be disposed.
|
||||
* It has to have a parent to be connected and a parent would hold a reference */
|
||||
g_assert (GST_PAD_PEER (pad) == NULL);
|
||||
|
||||
GST_DEBUG (GST_CAT_REFCOUNTING, "dispose %s:%s\n", GST_DEBUG_PAD_NAME(pad));
|
||||
|
||||
if (GST_PAD_PADTEMPLATE (pad)){
|
||||
|
@ -1435,11 +1439,6 @@ gst_real_pad_dispose (GObject *object)
|
|||
GST_PAD_PADTEMPLATE (pad) = NULL;
|
||||
}
|
||||
|
||||
if (GST_PAD_PEER (pad)){
|
||||
GST_DEBUG (GST_CAT_REFCOUNTING, "disconnecting pad '%s'\n", GST_OBJECT_NAME (GST_OBJECT (GST_PAD (GST_PAD_PEER (pad)))));
|
||||
gst_pad_disconnect (pad, GST_PAD (GST_PAD_PEER (pad)));
|
||||
}
|
||||
|
||||
/* we destroy the ghostpads, because they are nothing without the real pad */
|
||||
if (GST_REAL_PAD (pad)->ghostpads) {
|
||||
GList *orig, *ghostpads;
|
||||
|
|
Loading…
Reference in a new issue