mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-21 21:46:22 +00:00
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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/467>
This commit is contained in:
parent
cb212c9fd7
commit
e329e1f769
1 changed files with 3 additions and 1 deletions
|
@ -500,10 +500,12 @@ input_selector_push_buffer (gint stream, enum InputSelectorResult res)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Consumes a ref to the passed pad */
|
||||||
static gpointer
|
static gpointer
|
||||||
input_selector_do_push_eos (GstPad * pad)
|
input_selector_do_push_eos (GstPad * pad)
|
||||||
{
|
{
|
||||||
gst_pad_push_event (pad, gst_event_new_eos ());
|
gst_pad_push_event (pad, gst_event_new_eos ());
|
||||||
|
gst_object_unref (pad);
|
||||||
return NULL;
|
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
|
* from a separate thread. This makes this test racy, but it should only
|
||||||
* cause false positives, not false negatives */
|
* cause false positives, not false negatives */
|
||||||
GThread *t = g_thread_new ("selector-test-push-eos",
|
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
|
/* 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
|
* a definitive solution but there is no way to know when the
|
||||||
|
|
Loading…
Reference in a new issue