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
@ -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…
x
Reference in New Issue
Block a user