diff --git a/gst-libs/gst/gl/cocoa/gstglwindow_cocoa.m b/gst-libs/gst/gl/cocoa/gstglwindow_cocoa.m index e1996cf063..495d0227e8 100644 --- a/gst-libs/gst/gl/cocoa/gstglwindow_cocoa.m +++ b/gst-libs/gst/gl/cocoa/gstglwindow_cocoa.m @@ -386,8 +386,9 @@ gst_gl_window_cocoa_send_message_async (GstGLWindow * window, { GstGLWindowCocoa *window_cocoa = (GstGLWindowCocoa *) window; GstGLContext *context = gst_gl_window_get_context (window); + GThread *thread = gst_gl_context_get_thread (context); - if (gst_gl_context_get_thread (context) == g_thread_self()) { + if (thread == g_thread_self()) { /* this case happens for nested calls happening from inside the GCD queue */ callback (data); if (destroy) @@ -402,6 +403,8 @@ gst_gl_window_cocoa_send_message_async (GstGLWindow * window, destroy (data); }); } + if (thread) + g_thread_unref (thread); } /* =============================================================*/ diff --git a/gst-libs/gst/gl/eagl/gstglwindow_eagl.m b/gst-libs/gst/gl/eagl/gstglwindow_eagl.m index f130cc015f..72ab1abb53 100644 --- a/gst-libs/gst/gl/eagl/gstglwindow_eagl.m +++ b/gst-libs/gst/gl/eagl/gstglwindow_eagl.m @@ -150,8 +150,9 @@ gst_gl_window_eagl_send_message_async (GstGLWindow * window, { GstGLWindowEagl *window_eagl = (GstGLWindowEagl *) window; GstGLContext *context = gst_gl_window_get_context (window); + GThread *thread = gst_gl_context_get_thread (context); - if (gst_gl_context_get_thread (context) == g_thread_self()) { + if (thread == g_thread_self()) { /* this case happens for nested calls happening from inside the GCD queue */ callback (data); if (destroy) @@ -166,6 +167,8 @@ gst_gl_window_eagl_send_message_async (GstGLWindow * window, destroy (data); }); } + if (thread) + g_thread_unref (thread); } static void