Description: Fix issue with seg fault in pulsesink Pulsesink could sometimes seg fault before, so some code is tighted up a bit. See https://bugzilla.gnome.org/show_bug.cgi?id=683782 for a more detailed explanation. --- gst-plugins-good0.10-0.10.31.orig/ext/pulse/pulsesink.c +++ gst-plugins-good0.10-0.10.31/ext/pulse/pulsesink.c @@ -2053,8 +2053,7 @@ static gboolean gst_pulsesink_pad_acceptcaps (GstPad * pad, GstCaps * caps) { GstPulseSink *psink = GST_PULSESINK (gst_pad_get_parent_element (pad)); - GstPulseRingBuffer *pbuf = GST_PULSERING_BUFFER_CAST (GST_BASE_AUDIO_SINK - (psink)->ringbuffer); + GstPulseRingBuffer *pbuf = NULL; GstCaps *pad_caps; GstStructure *st; gboolean ret = FALSE; @@ -2073,10 +2072,20 @@ gst_pulsesink_pad_acceptcaps (GstPad * p gst_caps_unref (pad_caps); } - /* Either template caps didn't match, or we're still in NULL state */ - if (!ret || !pbuf->context) + /* Template caps didn't match */ + if (!ret) goto done; + GST_OBJECT_LOCK (psink); + pbuf = GST_PULSERING_BUFFER_CAST (GST_BASE_AUDIO_SINK (psink)->ringbuffer); + if (pbuf != NULL) + gst_object_ref (pbuf); + GST_OBJECT_UNLOCK (psink); + + /* We're still in NULL state */ + if (pbuf == NULL || pbuf->context == NULL) + goto done; + /* If we've not got fixed caps, creating a stream might fail, so let's just * return from here with default acceptcaps behaviour */ if (!gst_caps_is_fixed (caps)) @@ -2171,6 +2180,8 @@ out: done: gst_object_unref (psink); + if (pbuf != NULL) + gst_object_unref (pbuf); return ret; info_failed: