From: Vincent Penquerc'h Date: Mon, 15 Aug 2016 15:14:25 +0000 (+0100) Subject: glcontext: fix race joining thread on finalize X-Git-Tag: 1.19.3~511^2~1989^2~276 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b9224e62b5f2a1ed70093c773a3760c317d2dce5;p=platform%2Fupstream%2Fgstreamer.git glcontext: fix race joining thread on finalize https://bugzilla.gnome.org/show_bug.cgi?id=769939 --- diff --git a/gst-libs/gst/gl/gstglcontext.c b/gst-libs/gst/gl/gstglcontext.c index d222e08..2bc0a78 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; }