mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-22 15:18:21 +00:00
adaptivedemux2: Fix a small race on shutdown
Make sure gst_adaptive_demux_loop_cancel_call() never tries to operate on an invalidated main context. Make sure to clear the main context pointer while holding the lock, and to check it in gst_adaptive_demux_loop_cancel_call() Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2847>
This commit is contained in:
parent
cf64c9f588
commit
b7e662f400
1 changed files with 7 additions and 5 deletions
|
@ -215,11 +215,12 @@ _gst_adaptive_demux_loop_thread (GstAdaptiveDemuxLoop * loop)
|
|||
loop->loop = NULL;
|
||||
|
||||
g_cond_broadcast (&loop->cond);
|
||||
g_mutex_unlock (&loop->lock);
|
||||
|
||||
g_main_context_unref (loop->context);
|
||||
loop->context = NULL;
|
||||
|
||||
g_mutex_unlock (&loop->lock);
|
||||
|
||||
gst_adaptive_demux_loop_unref (loop);
|
||||
|
||||
return NULL;
|
||||
|
@ -380,12 +381,13 @@ gst_adaptive_demux_loop_call_delayed (GstAdaptiveDemuxLoop * loop,
|
|||
void
|
||||
gst_adaptive_demux_loop_cancel_call (GstAdaptiveDemuxLoop * loop, guint cb_id)
|
||||
{
|
||||
GSource *s;
|
||||
|
||||
g_mutex_lock (&loop->lock);
|
||||
s = g_main_context_find_source_by_id (loop->context, cb_id);
|
||||
if (loop->context) {
|
||||
GSource *s = g_main_context_find_source_by_id (loop->context, cb_id);
|
||||
if (s)
|
||||
g_source_destroy (s);
|
||||
}
|
||||
g_mutex_unlock (&loop->lock);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue