mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-02 20:42:30 +00:00
glimagesink: If creating a context or upload failed, destroy it
Fixes deadlocks in error cases when later code assumes the broken context is actually usable. https://bugzilla.gnome.org/show_bug.cgi?id=728761
This commit is contained in:
parent
516597d5fa
commit
38ebfb2da8
1 changed files with 8 additions and 2 deletions
|
@ -422,8 +422,10 @@ _ensure_gl_setup (GstGLImageSink * gl_sink)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gst_gl_context_create (gl_sink->context, gl_sink->other_context,
|
if (!gst_gl_context_create (gl_sink->context, gl_sink->other_context,
|
||||||
&error))
|
&error)) {
|
||||||
|
g_object_unref (window);
|
||||||
goto context_error;
|
goto context_error;
|
||||||
|
}
|
||||||
|
|
||||||
/* setup callbacks */
|
/* setup callbacks */
|
||||||
gst_gl_window_set_resize_callback (window,
|
gst_gl_window_set_resize_callback (window,
|
||||||
|
@ -436,7 +438,7 @@ _ensure_gl_setup (GstGLImageSink * gl_sink)
|
||||||
GST_GL_WINDOW_CB (gst_glimage_sink_on_close),
|
GST_GL_WINDOW_CB (gst_glimage_sink_on_close),
|
||||||
gst_object_ref (gl_sink), (GDestroyNotify) gst_object_unref);
|
gst_object_ref (gl_sink), (GDestroyNotify) gst_object_unref);
|
||||||
|
|
||||||
gst_object_unref (window);
|
g_object_unref (window);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gl_sink->upload) {
|
if (!gl_sink->upload) {
|
||||||
|
@ -451,12 +453,16 @@ upload_error:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (gl_sink, RESOURCE, NOT_FOUND, ("Failed to init upload"),
|
GST_ELEMENT_ERROR (gl_sink, RESOURCE, NOT_FOUND, ("Failed to init upload"),
|
||||||
(NULL));
|
(NULL));
|
||||||
|
g_object_unref (gl_sink->upload);
|
||||||
|
gl_sink->upload = NULL;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
context_error:
|
context_error:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (gl_sink, RESOURCE, NOT_FOUND, ("%s", error->message),
|
GST_ELEMENT_ERROR (gl_sink, RESOURCE, NOT_FOUND, ("%s", error->message),
|
||||||
(NULL));
|
(NULL));
|
||||||
|
g_object_unref (gl_sink->context);
|
||||||
|
gl_sink->context = NULL;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue