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
This commit is contained in:
Víctor Manuel Jáquez Leal 2015-02-26 13:20:26 +01:00 committed by Tim-Philipp Müller
parent d3c7f20aee
commit e3d457ec8e

View file

@ -576,6 +576,8 @@ _upload_meta_upload_free (gpointer impl)
struct GLUploadMeta *upload = impl; struct GLUploadMeta *upload = impl;
gint i; gint i;
g_return_if_fail (impl != NULL);
for (i = 0; i < GST_VIDEO_MAX_PLANES; i++) { for (i = 0; i < GST_VIDEO_MAX_PLANES; i++) {
if (upload->texture_ids[i]) if (upload->texture_ids[i])
gst_gl_context_del_texture (upload->upload->context, 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)) if (upload->priv->method_i >= G_N_ELEMENTS (upload_methods))
return FALSE; return FALSE;
if (upload->priv->method_impl) if (upload->priv->method_impl) {
upload->priv->method->free (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 = upload_methods[upload->priv->method_i];
upload->priv->method_impl = upload->priv->method->new (upload); upload->priv->method_impl = upload->priv->method->new (upload);
@ -1039,6 +1043,7 @@ restart:
} else { } else {
gst_gl_upload_release_buffer_unlocked (upload); gst_gl_upload_release_buffer_unlocked (upload);
upload->priv->method->free (upload->priv->method_impl); upload->priv->method->free (upload->priv->method_impl);
upload->priv->method_impl = NULL;
NEXT_METHOD; NEXT_METHOD;
} }