summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Penquerc'h <vincent.penquerch@collabora.co.uk>2016-08-15 16:14:25 +0100
committerMatthew Waters <matthew@centricular.com>2016-08-16 13:10:30 +1000
commit2776cef25d2a98668b73272aecfe77e684e6627e (patch)
tree954bb619d320af75824c1cae67f77a434055f7e8
parent117f81dc00a5e9fbfa24321b316d803dd2629cc1 (diff)
glcontext: fix race joining thread on finalize
https://bugzilla.gnome.org/show_bug.cgi?id=769939
-rw-r--r--gst-libs/gst/gl/gstglcontext.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/gst-libs/gst/gl/gstglcontext.c b/gst-libs/gst/gl/gstglcontext.c
index d222e086c..2bc0a780a 100644
--- a/gst-libs/gst/gl/gstglcontext.c
+++ b/gst-libs/gst/gl/gstglcontext.c
@@ -642,7 +642,14 @@ gst_gl_context_finalize (GObject * object)
gst_gl_window_quit (context->window);
GST_INFO_OBJECT (context, "joining gl thread");
- g_thread_join (context->priv->gl_thread);
+ g_mutex_lock (&context->priv->render_lock);
+ if (context->priv->alive) {
+ GThread *t = context->priv->gl_thread;
+ g_mutex_unlock (&context->priv->render_lock);
+ g_thread_join (t);
+ } else {
+ g_mutex_unlock (&context->priv->render_lock);
+ }
GST_INFO_OBJECT (context, "gl thread joined");
context->priv->gl_thread = NULL;
}