Check that collectpads exists before removing pad

The core now calls release pad from finalize, at which point
the collectpads might have already been freed.
This commit is contained in:
David Schleef 2011-02-20 23:39:41 -08:00
parent 13d441315f
commit 8e6b876e76
6 changed files with 23 additions and 6 deletions

View file

@ -208,6 +208,7 @@ gst_text_overlay_finalize (GObject * object)
gst_collect_pads_stop (overlay->collect);
gst_object_unref (overlay->collect);
overlay->collect = NULL;
g_free (overlay->text_fill_image);
g_free (overlay->text_outline_image);
@ -631,7 +632,9 @@ gst_text_overlay_text_pad_unlinked (GstPad * pad)
GST_DEBUG_OBJECT (overlay, "Text pad unlinked");
if (overlay->text_collect_data) {
gst_collect_pads_remove_pad (overlay->collect, overlay->text_sinkpad);
if (overlay->collect) {
gst_collect_pads_remove_pad (overlay->collect, overlay->text_sinkpad);
}
overlay->text_collect_data = NULL;
}

View file

@ -285,6 +285,7 @@ gst_avi_mux_finalize (GObject * object)
mux->idx = NULL;
gst_object_unref (mux->collect);
mux->collect = NULL;
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@ -1089,7 +1090,9 @@ gst_avi_mux_release_pad (GstElement * element, GstPad * pad)
* as it also represent number of streams present */
avipad->collect = NULL;
GST_DEBUG_OBJECT (avimux, "removed pad '%s'", GST_PAD_NAME (pad));
gst_collect_pads_remove_pad (avimux->collect, pad);
if (avimux->collect) {
gst_collect_pads_remove_pad (avimux->collect, pad);
}
gst_element_remove_pad (element, pad);
/* if not started yet, we can remove any sign this pad ever existed */
/* in this case _start will take care of the real pad count */

View file

@ -207,6 +207,7 @@ gst_flv_mux_finalize (GObject * object)
GstFlvMux *mux = GST_FLV_MUX (object);
gst_object_unref (mux->collect);
mux->collect = NULL;
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@ -559,7 +560,9 @@ gst_flv_mux_release_pad (GstElement * element, GstPad * pad)
if (cpad && cpad->video_codec_data)
gst_buffer_unref (cpad->video_codec_data);
gst_collect_pads_remove_pad (mux->collect, pad);
if (mux->collect) {
gst_collect_pads_remove_pad (mux->collect, pad);
}
gst_element_remove_pad (element, pad);
}

View file

@ -598,7 +598,9 @@ gst_interleave_release_pad (GstElement * element, GstPad * pad)
GST_OBJECT_UNLOCK (self->collect);
gst_collect_pads_remove_pad (self->collect, pad);
if (self->collect) {
gst_collect_pads_remove_pad (self->collect, pad);
}
gst_element_remove_pad (element, pad);
}

View file

@ -385,6 +385,7 @@ gst_matroska_mux_finalize (GObject * object)
GstMatroskaMux *mux = GST_MATROSKA_MUX (object);
gst_object_unref (mux->collect);
mux->collect = NULL;
gst_object_unref (mux->ebml_write);
if (mux->writing_app)
g_free (mux->writing_app);
@ -1929,7 +1930,9 @@ gst_matroska_mux_release_pad (GstElement * element, GstPad * pad)
}
}
gst_collect_pads_remove_pad (mux->collect, pad);
if (mux->collect) {
gst_collect_pads_remove_pad (mux->collect, pad);
}
if (gst_element_remove_pad (element, pad))
mux->num_streams--;
}

View file

@ -777,6 +777,7 @@ gst_videomixer_finalize (GObject * object)
GstVideoMixer *mix = GST_VIDEO_MIXER (object);
gst_object_unref (mix->collect);
mix->collect = NULL;
g_mutex_free (mix->state_lock);
G_OBJECT_CLASS (parent_class)->finalize (object);
@ -1251,7 +1252,9 @@ gst_videomixer_release_pad (GstElement * element, GstPad * pad)
mix->sinkpads = g_slist_remove (mix->sinkpads, pad);
gst_videomixer_collect_free (mixpad->mixcol);
gst_collect_pads_remove_pad (mix->collect, pad);
if (mix->collect) {
gst_collect_pads_remove_pad (mix->collect, pad);
}
gst_child_proxy_child_removed (GST_OBJECT (mix), GST_OBJECT (mixpad));
/* determine possibly new geometry and master */
gst_videomixer_set_master_geometry (mix);