qtmux: Remove the pad from our internal list before calling collectpads

Previously we would end up with the collectpaddata structure already freed.
This would result in a bogus iteration of mux->sinkpads (all the
GstQTPad being freed) and it wouldn't be removed from that list.

Finally, due to it not being removed from that list, we would end up
calling a bogus gst_qt_mux_pad_reset on those structures => SEGFAULT
This commit is contained in:
Edward Hervey 2010-06-21 19:39:54 +02:00 committed by Tim-Philipp Müller
parent 4bb9ffa8fb
commit 0fa380b199

View file

@ -2498,24 +2498,21 @@ gst_qt_mux_release_pad (GstElement * element, GstPad * pad)
{ {
GstQTMux *mux = GST_QT_MUX_CAST (element); GstQTMux *mux = GST_QT_MUX_CAST (element);
GSList *walk; GSList *walk;
gboolean to_remove;
/* let GstCollectPads complain if it is some unknown pad */ GST_DEBUG_OBJECT (element, "Releasing %s:%s", GST_DEBUG_PAD_NAME (pad));
if (gst_collect_pads_remove_pad (mux->collect, pad)) {
gst_element_remove_pad (element, pad); for (walk = mux->sinkpads; walk; walk = g_slist_next (walk)) {
to_remove = TRUE; GstQTPad *qtpad = (GstQTPad *) walk->data;
for (walk = mux->sinkpads; walk; walk = g_slist_next (walk)) { GST_DEBUG ("Checking %s:%s", GST_DEBUG_PAD_NAME (qtpad->collect.pad));
GstQTPad *qtpad = (GstQTPad *) walk->data; if (qtpad->collect.pad == pad) {
if (qtpad->collect.pad == pad) { /* this is it, remove */
/* this is it, remove */ mux->sinkpads = g_slist_delete_link (mux->sinkpads, walk);
mux->sinkpads = g_slist_delete_link (mux->sinkpads, walk); gst_element_remove_pad (element, pad);
to_remove = FALSE; break;
break;
}
} }
if (to_remove)
GST_WARNING_OBJECT (mux, "Released pad not in internal sinkpad list");
} }
gst_collect_pads_remove_pad (mux->collect, pad);
} }
static GstPad * static GstPad *