gldisplay: really retrieve glcontext for a specific thread
authorMark Nauwelaerts <mnauw@users.sourceforge.net>
Sat, 5 Mar 2016 16:16:24 +0000 (17:16 +0100)
committerTim-Philipp Müller <tim@centricular.com>
Sat, 9 Dec 2017 19:32:17 +0000 (19:32 +0000)
When requesting a glcontext (regardless of thread), the result was correct.
However, when requesting current glcontext on a specific thread, it could
come up with a glcontext active on another thread.

https://bugzilla.gnome.org/show_bug.cgi?id=763168

gst-libs/gst/gl/gstgldisplay.c

index 60dec6a..65ce1a3 100644 (file)
@@ -437,8 +437,11 @@ _get_gl_context_for_thread_unlocked (GstGLDisplay * display, GThread * thread)
       continue;
     }
 
+    if (thread == NULL)
+      return context;
+
     context_thread = gst_gl_context_get_thread (context);
-    if (thread != NULL && thread == context_thread) {
+    if (thread != context_thread) {
       g_thread_unref (context_thread);
       gst_object_unref (context);
       prev = l;