base: Unref events if the parent element disappeared

And also unref events if the basetransform subclass has no
event handler and the event is not forwarded at all.
This commit is contained in:
Sebastian Dröge 2011-04-08 14:55:09 +02:00
parent 0daedb7409
commit 237e54d4fe
2 changed files with 9 additions and 2 deletions

View file

@ -1759,8 +1759,11 @@ gst_base_src_event_handler (GstPad * pad, GstEvent * event)
gboolean result = FALSE;
src = GST_BASE_SRC (gst_pad_get_parent (pad));
if (G_UNLIKELY (src == NULL))
if (G_UNLIKELY (src == NULL)) {
gst_event_unref (event);
return FALSE;
}
bclass = GST_BASE_SRC_GET_CLASS (src);
if (bclass->event) {

View file

@ -2085,13 +2085,17 @@ gst_base_transform_src_event (GstPad * pad, GstEvent * event)
gboolean ret = TRUE;
trans = GST_BASE_TRANSFORM (gst_pad_get_parent (pad));
if (G_UNLIKELY (trans == NULL))
if (G_UNLIKELY (trans == NULL)) {
gst_event_unref (event);
return FALSE;
}
bclass = GST_BASE_TRANSFORM_GET_CLASS (trans);
if (bclass->src_event)
ret = bclass->src_event (trans, event);
else
gst_event_unref (event);
gst_object_unref (trans);