From b43db2f2a26973fa270a8d678a91d377ddffb846 Mon Sep 17 00:00:00 2001 From: Thiago Santos Date: Wed, 26 Jan 2011 12:16:58 -0300 Subject: [PATCH] streamsplitter: release pending events refs Unref pending events when disposing the streamsplitter. Also refactor a little to replace a for with a g_list_foreach --- gst/encoding/gststreamsplitter.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/gst/encoding/gststreamsplitter.c b/gst/encoding/gststreamsplitter.c index a2fa589f36..c473386e56 100644 --- a/gst/encoding/gststreamsplitter.c +++ b/gst/encoding/gststreamsplitter.c @@ -88,6 +88,11 @@ gst_stream_splitter_dispose (GObject * object) stream_splitter->lock = NULL; } + g_list_foreach (stream_splitter->pending_events, (GFunc) gst_event_unref, + NULL); + g_list_free (stream_splitter->pending_events); + stream_splitter->pending_events = NULL; + G_OBJECT_CLASS (gst_stream_splitter_parent_class)->dispose (object); } @@ -173,9 +178,8 @@ gst_stream_splitter_sink_event (GstPad * pad, GstEvent * event) } if (flushpending) { - GList *tmp; - for (tmp = stream_splitter->pending_events; tmp; tmp = tmp->next) - gst_event_unref ((GstEvent *) tmp->data); + g_list_foreach (stream_splitter->pending_events, (GFunc) gst_event_unref, + NULL); g_list_free (stream_splitter->pending_events); stream_splitter->pending_events = NULL; }