summaryrefslogtreecommitdiff
path: root/gst-libs/gst
diff options
context:
space:
mode:
authorMatthew Waters <matthew@centricular.com>2016-04-13 00:43:18 +1000
committerMatthew Waters <matthew@centricular.com>2016-04-13 01:03:20 +1000
commitb3b73d39a06b4630a82681dd8870e577ce3f4ae5 (patch)
treee72110cf756c8c23bf6929644a2744fce2597e69 /gst-libs/gst
parent43a656b29682a502c700f95ae80f276d64b7c9e9 (diff)
downloadgstreamer-plugins-bad-b3b73d39a06b4630a82681dd8870e577ce3f4ae5.tar.gz
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.
Diffstat (limited to 'gst-libs/gst')
-rw-r--r--gst-libs/gst/gl/cocoa/gstglwindow_cocoa.m5
-rw-r--r--gst-libs/gst/gl/eagl/gstglwindow_eagl.m5
2 files changed, 8 insertions, 2 deletions
diff --git a/gst-libs/gst/gl/cocoa/gstglwindow_cocoa.m b/gst-libs/gst/gl/cocoa/gstglwindow_cocoa.m
index e1996cf06..495d0227e 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 f130cc015..72ab1abb5 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