gl: Let gst_gl_context_get_thread() return a new reference to the GThread
authorSebastian Dröge <sebastian@centricular.com>
Mon, 22 Sep 2014 07:08:17 +0000 (10:08 +0300)
committerSebastian Dröge <sebastian@centricular.com>
Mon, 22 Sep 2014 07:09:24 +0000 (10:09 +0300)
Otherwise it might go away in the meantime and the caller has some random pointer.

gst-libs/gst/gl/gstglcontext.c

index 9d59ff5..9a72f56 100644 (file)
@@ -422,7 +422,7 @@ gst_gl_context_activate (GstGLContext * context, gboolean activate)
  * gst_gl_context_get_thread:
  * @context: a #GstGLContext
  *
- * Returns: The #GThread, @context is current in or NULL
+ * Returns: (transfer full): The #GThread, @context is current in or NULL
  *
  * Since: 1.6
  */
@@ -433,6 +433,8 @@ gst_gl_context_get_thread (GstGLContext * context)
 
   GST_OBJECT_LOCK (context);
   ret = context->priv->active_thread;
+  if (ret)
+    g_thread_ref (ret);
   GST_OBJECT_UNLOCK (context);
 
   return ret;