From e329e1f769e0a426227e5ff86bc724c203ca39f6 Mon Sep 17 00:00:00 2001 From: Jan Schmidt Date: Thu, 7 May 2020 03:28:59 +1000 Subject: [PATCH] tests/input selector: Fix a shutdown crash Hold a ref to the pad we're planning on sending EOS too, so that it doesn't disappear if things shut down before the thread gets to actually send the EOS event. Part-of: --- tests/check/elements/selector.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/check/elements/selector.c b/tests/check/elements/selector.c index 0570f138fe..529c0460af 100644 --- a/tests/check/elements/selector.c +++ b/tests/check/elements/selector.c @@ -500,10 +500,12 @@ input_selector_push_buffer (gint stream, enum InputSelectorResult res) } } +/* Consumes a ref to the passed pad */ static gpointer input_selector_do_push_eos (GstPad * pad) { gst_pad_push_event (pad, gst_event_new_eos ()); + gst_object_unref (pad); return NULL; } @@ -533,7 +535,7 @@ input_selector_push_eos (gint stream, gboolean active) * from a separate thread. This makes this test racy, but it should only * cause false positives, not false negatives */ GThread *t = g_thread_new ("selector-test-push-eos", - (GThreadFunc) input_selector_do_push_eos, pad); + (GThreadFunc) input_selector_do_push_eos, gst_object_ref (pad)); /* Sleep half a second to allow the other thread to execute, this is not * a definitive solution but there is no way to know when the