From f1bbb0f8a4557b1ef5f06dc59c693db216937a53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Tue, 22 Nov 2011 19:57:07 +0000 Subject: [PATCH] basevideodecoder: fix weird event list handling Get rid of weird code that copies a list manually, taking ownership of the elements and then frees the old list. Instead, just take over the old list entirely. (If the intent was to reverse the list, one could use g_list_reverse() instead). Then, push events in the list out from last to first (since they were prepended as they came in) instead of just pushing out the last in the list and leaking the others. --- omx/gstbasevideodecoder.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/omx/gstbasevideodecoder.c b/omx/gstbasevideodecoder.c index 1b01ed701c..34f9ef429c 100644 --- a/omx/gstbasevideodecoder.c +++ b/omx/gstbasevideodecoder.c @@ -1405,11 +1405,7 @@ gst_base_video_decoder_finish_frame (GstBaseVideoDecoder * base_video_decoder, GstVideoFrame *tmp = l->data; if (tmp->events) { - GList *k; - - for (k = g_list_last (tmp->events); k; k = k->prev) - events = g_list_prepend (events, k->data); - g_list_free (tmp->events); + events = tmp->events; tmp->events = NULL; } @@ -1417,7 +1413,7 @@ gst_base_video_decoder_finish_frame (GstBaseVideoDecoder * base_video_decoder, break; } - for (l = g_list_last (events); l; l = l->next) + for (l = g_list_last (events); l; l = l->prev) gst_pad_push_event (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_decoder), l->data); g_list_free (events);