gl/cocoa/eagl: don't leak GThread's when dispatching messages

gst_gl_context_get_thread() returns a refed pointer, we need to unref it.
This commit is contained in:
Matthew Waters 2016-04-13 00:43:18 +10:00 committed by Tim-Philipp Müller
parent 73110e6985
commit 614f80cbcf
2 changed files with 8 additions and 2 deletions

View file

@ -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);
}
/* =============================================================*/

View file

@ -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