From e3d457ec8eb5cd27bd545ce384f876da363d22ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Thu, 26 Feb 2015 13:20:26 +0100 Subject: [PATCH] glupload: Set freed method implementation to NULL When trying to render buffers with meta:GLTextureUpload the glimagesink crashes with a segmentation fault. This patch workarounds this crash setting to NULL the method implementation after free. https://bugzilla.gnome.org/show_bug.cgi?id=745206 --- gst-libs/gst/gl/gstglupload.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gst-libs/gst/gl/gstglupload.c b/gst-libs/gst/gl/gstglupload.c index e1afba3fb4..47b4608ce2 100644 --- a/gst-libs/gst/gl/gstglupload.c +++ b/gst-libs/gst/gl/gstglupload.c @@ -576,6 +576,8 @@ _upload_meta_upload_free (gpointer impl) struct GLUploadMeta *upload = impl; gint i; + g_return_if_fail (impl != NULL); + for (i = 0; i < GST_VIDEO_MAX_PLANES; i++) { if (upload->texture_ids[i]) gst_gl_context_del_texture (upload->upload->context, @@ -971,8 +973,10 @@ _upload_find_method (GstGLUpload * upload) if (upload->priv->method_i >= G_N_ELEMENTS (upload_methods)) return FALSE; - if (upload->priv->method_impl) + if (upload->priv->method_impl) { upload->priv->method->free (upload->priv->method_impl); + upload->priv->method_impl = NULL; + } upload->priv->method = upload_methods[upload->priv->method_i]; upload->priv->method_impl = upload->priv->method->new (upload); @@ -1039,6 +1043,7 @@ restart: } else { gst_gl_upload_release_buffer_unlocked (upload); upload->priv->method->free (upload->priv->method_impl); + upload->priv->method_impl = NULL; NEXT_METHOD; }