mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 17:50:36 +00:00
pulsesink: don't free the context multiple times
Apparently the close function of the ring-buffer can be called multiple times.
This commit is contained in:
parent
988f228da7
commit
a313bc7524
1 changed files with 21 additions and 14 deletions
|
@ -283,12 +283,17 @@ gst_pulsering_get_context (GstPulseRingBuffer * pbuf)
|
||||||
static void
|
static void
|
||||||
gst_pulsering_destroy_context (GstPulseRingBuffer * pbuf)
|
gst_pulsering_destroy_context (GstPulseRingBuffer * pbuf)
|
||||||
{
|
{
|
||||||
GstPulseContext *pctx;
|
|
||||||
GstPulseSink *psink;
|
GstPulseSink *psink;
|
||||||
|
|
||||||
g_mutex_lock (pa_ring_buffer_mutex);
|
g_mutex_lock (pa_ring_buffer_mutex);
|
||||||
psink = GST_PULSESINK_CAST (GST_OBJECT_PARENT (pbuf));
|
psink = GST_PULSESINK_CAST (GST_OBJECT_PARENT (pbuf));
|
||||||
|
|
||||||
|
if (pbuf->context_name) {
|
||||||
|
GstPulseContext *pctx;
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (psink, "destroying context for pbuf=%p '%s'",
|
||||||
|
pbuf, pbuf->context_name);
|
||||||
|
|
||||||
pctx = g_hash_table_lookup (gst_pulse_shared_contexts, pbuf->context_name);
|
pctx = g_hash_table_lookup (gst_pulse_shared_contexts, pbuf->context_name);
|
||||||
|
|
||||||
gst_pulsering_destroy_stream (pbuf);
|
gst_pulsering_destroy_stream (pbuf);
|
||||||
|
@ -307,9 +312,11 @@ gst_pulsering_destroy_context (GstPulseRingBuffer * pbuf)
|
||||||
pa_context_unref (pctx->context);
|
pa_context_unref (pctx->context);
|
||||||
g_hash_table_remove (gst_pulse_shared_contexts, pbuf->context_name);
|
g_hash_table_remove (gst_pulse_shared_contexts, pbuf->context_name);
|
||||||
g_free (pbuf->context_name);
|
g_free (pbuf->context_name);
|
||||||
|
pbuf->context_name = NULL;
|
||||||
g_slice_free (GstPulseContext, pctx);
|
g_slice_free (GstPulseContext, pctx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
g_mutex_unlock (pa_ring_buffer_mutex);
|
g_mutex_unlock (pa_ring_buffer_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue