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 4a6a5300a2c..e7add4652b2 100644 --- a/libs/fluidsynth/glib.c +++ b/libs/fluidsynth/glib.c @@ -57,7 +57,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; }
@@ -81,8 +81,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 )