mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-05 15:08:53 +00:00
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:
parent
43a656b296
commit
b3b73d39a0
2 changed files with 8 additions and 2 deletions
|
@ -386,8 +386,9 @@ gst_gl_window_cocoa_send_message_async (GstGLWindow * window,
|
||||||
{
|
{
|
||||||
GstGLWindowCocoa *window_cocoa = (GstGLWindowCocoa *) window;
|
GstGLWindowCocoa *window_cocoa = (GstGLWindowCocoa *) window;
|
||||||
GstGLContext *context = gst_gl_window_get_context (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 */
|
/* this case happens for nested calls happening from inside the GCD queue */
|
||||||
callback (data);
|
callback (data);
|
||||||
if (destroy)
|
if (destroy)
|
||||||
|
@ -402,6 +403,8 @@ gst_gl_window_cocoa_send_message_async (GstGLWindow * window,
|
||||||
destroy (data);
|
destroy (data);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (thread)
|
||||||
|
g_thread_unref (thread);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* =============================================================*/
|
/* =============================================================*/
|
||||||
|
|
|
@ -150,8 +150,9 @@ gst_gl_window_eagl_send_message_async (GstGLWindow * window,
|
||||||
{
|
{
|
||||||
GstGLWindowEagl *window_eagl = (GstGLWindowEagl *) window;
|
GstGLWindowEagl *window_eagl = (GstGLWindowEagl *) window;
|
||||||
GstGLContext *context = gst_gl_window_get_context (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 */
|
/* this case happens for nested calls happening from inside the GCD queue */
|
||||||
callback (data);
|
callback (data);
|
||||||
if (destroy)
|
if (destroy)
|
||||||
|
@ -166,6 +167,8 @@ gst_gl_window_eagl_send_message_async (GstGLWindow * window,
|
||||||
destroy (data);
|
destroy (data);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (thread)
|
||||||
|
g_thread_unref (thread);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in a new issue