From: Jinoh Kang jinoh.kang.kr@gmail.com
Fixes: f768d6b31bebc35fbaf751d0cd57c8bd302a8d60 --- libs/fluidsynth/glib.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/libs/fluidsynth/glib.c b/libs/fluidsynth/glib.c index 2450924eb78..bdab5505daa 100644 --- a/libs/fluidsynth/glib.c +++ b/libs/fluidsynth/glib.c @@ -62,7 +62,7 @@ static DWORD CALLBACK g_thread_wrapper( void *args ) { GThread *thread = args; gpointer ret = thread->func( thread->data ); - if (!InterlockedDecrement( &thread->ref )) free( thread ); + g_thread_unref( thread ); return (UINT_PTR)ret; }
@@ -86,8 +86,11 @@ GThread *g_thread_try_new( const char *name, GThreadFunc func, gpointer data, GE
void g_thread_unref( GThread *thread ) { - CloseHandle( thread->handle ); - if (!InterlockedDecrement( &thread->ref )) free( thread ); + if (!InterlockedDecrement( &thread->ref )) + { + CloseHandle( thread->handle ); + free( thread ); + } }
void g_thread_join( GThread *thread )