summaryrefslogtreecommitdiff
path: root/ext/gl
diff options
context:
space:
mode:
authorMatthew Waters <matthew@centricular.com>2015-05-13 23:54:52 +1000
committerMatthew Waters <matthew@centricular.com>2015-05-13 23:56:48 +1000
commit1853e455accb4fac1c5a2d5c8d9315615fcb5804 (patch)
tree56daaf6c1d995a0612b6fa96afb7ea8cfbd94ebd /ext/gl
parent5f6bddf7193539df1d627316139dfd6414e5ce58 (diff)
downloadgstreamer-plugins-bad-1853e455accb4fac1c5a2d5c8d9315615fcb5804.tar.gz
gl: don't deadlock on context creation failure
https://bugzilla.gnome.org/show_bug.cgi?id=749284
Diffstat (limited to 'ext/gl')
-rw-r--r--ext/gl/gstglbasemixer.c4
-rw-r--r--ext/gl/gstglimagesink.c5
-rw-r--r--ext/gl/gstgltestsrc.c7
3 files changed, 12 insertions, 4 deletions
diff --git a/ext/gl/gstglbasemixer.c b/ext/gl/gstglbasemixer.c
index 0e670e044..d462c161a 100644
--- a/ext/gl/gstglbasemixer.c
+++ b/ext/gl/gstglbasemixer.c
@@ -477,8 +477,10 @@ gst_gl_base_mixer_decide_allocation (GstGLBaseMixer * mix, GstQuery * query)
if (!mix->context) {
mix->context = gst_gl_context_new (mix->display);
if (!gst_gl_context_create (mix->context, mix->priv->other_context,
- &error))
+ &error)) {
+ GST_OBJECT_UNLOCK (mix->display);
goto context_error;
+ }
}
} while (!gst_gl_display_add_context (mix->display, mix->context));
GST_OBJECT_UNLOCK (mix->display);
diff --git a/ext/gl/gstglimagesink.c b/ext/gl/gstglimagesink.c
index 15aebe2e3..0315bfd40 100644
--- a/ext/gl/gstglimagesink.c
+++ b/ext/gl/gstglimagesink.c
@@ -703,8 +703,10 @@ _ensure_gl_setup (GstGLImageSink * gl_sink)
gl_sink->display);
gl_sink->context = gst_gl_context_new (gl_sink->display);
- if (!gl_sink->context)
+ if (!gl_sink->context) {
+ GST_OBJECT_UNLOCK (gl_sink->display);
goto context_creation_error;
+ }
window = gst_gl_context_get_window (gl_sink->context);
@@ -738,6 +740,7 @@ _ensure_gl_setup (GstGLImageSink * gl_sink)
if (other_context)
gst_object_unref (other_context);
gst_object_unref (window);
+ GST_OBJECT_UNLOCK (gl_sink->display);
goto context_error;
}
diff --git a/ext/gl/gstgltestsrc.c b/ext/gl/gstgltestsrc.c
index eba66b043..4dca6cbeb 100644
--- a/ext/gl/gstgltestsrc.c
+++ b/ext/gl/gstgltestsrc.c
@@ -786,8 +786,10 @@ gst_gl_test_src_decide_allocation (GstBaseSrc * basesrc, GstQuery * query)
gst_gl_display_get_gl_context_for_thread (src->display, NULL);
if (!src->context) {
src->context = gst_gl_context_new (src->display);
- if (!gst_gl_context_create (src->context, src->other_context, &error))
+ if (!gst_gl_context_create (src->context, src->other_context, &error)) {
+ GST_OBJECT_UNLOCK (src->display);
goto context_error;
+ }
}
} while (!gst_gl_display_add_context (src->display, src->context));
GST_OBJECT_UNLOCK (src->display);
@@ -849,7 +851,8 @@ context_error:
{
GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND, ("%s", error->message),
(NULL));
- gst_object_unref (src->context);
+ if (src->context)
+ gst_object_unref (src->context);
src->context = NULL;
return FALSE;
}