From 44c47e4b9d6c532cc3e6cf2bcf9b5090396d844e Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 25 Aug 2016 11:06:23 +0000 Subject: delay CloseHandle() to the thread finish git-svn-id: http://svn.miranda-ng.org/main/trunk@17207 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/mir_core/src/threads.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mir_core/src/threads.cpp b/src/mir_core/src/threads.cpp index f4e247e65c..1d9cd65742 100644 --- a/src/mir_core/src/threads.cpp +++ b/src/mir_core/src/threads.cpp @@ -113,12 +113,13 @@ DWORD WINAPI forkthread_r(void *arg) FORK_ARG *fa = (FORK_ARG*)arg; pThreadFunc callercode = fa->threadcode; void *cookie = fa->arg; - CloseHandle(fa->hThread); + HANDLE hThread = fa->hThread; Thread_Push((HINSTANCE)callercode); SetEvent(fa->hEvent); callercode(cookie); + CloseHandle(hThread); SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL); Thread_Pop(); return 0; -- cgit v1.2.3