From b3279c3fce41b0c01da0f0c783a5337915f2140e Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Sat, 3 Nov 2018 20:20:50 +0900 Subject: [PATCH] d3dvideosink: Don't leak GThread object Need to call g_thread_join() to avoid leak --- sys/d3dvideosink/d3dhelpers.c | 8 ++++++++ sys/d3dvideosink/d3dvideosink.h | 1 + 2 files changed, 9 insertions(+) diff --git a/sys/d3dvideosink/d3dhelpers.c b/sys/d3dvideosink/d3dhelpers.c index c49d3c5dc8..9b0e991df6 100644 --- a/sys/d3dvideosink/d3dhelpers.c +++ b/sys/d3dvideosink/d3dhelpers.c @@ -1208,6 +1208,12 @@ d3d_stop (GstD3DVideoSink * sink) /* Release D3D resources */ d3d_set_window_handle (sink, 0, FALSE); + + if (sink->internal_window_thread) { + g_thread_join (sink->internal_window_thread); + sink->internal_window_thread = NULL; + } + return TRUE; } @@ -2262,6 +2268,8 @@ d3d_create_internal_window (GstD3DVideoSink * sink) return 0; } + sink->internal_window_thread = thread; + /* Wait 10 seconds for window proc loop to start up */ for (i = 0; dat.running == FALSE && i < intervals; i++) { g_usleep (timeout_interval); diff --git a/sys/d3dvideosink/d3dvideosink.h b/sys/d3dvideosink/d3dvideosink.h index de0da25624..67ac6c01c4 100644 --- a/sys/d3dvideosink/d3dvideosink.h +++ b/sys/d3dvideosink/d3dvideosink.h @@ -60,6 +60,7 @@ struct _GstD3DVideoSink GstVideoRectangle render_rect; GRecMutex lock; + GThread *internal_window_thread; /* Properties */ gboolean force_aspect_ratio;