summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mir_core/src/threads.cpp3
1 files changed, 2 insertions, 1 deletions
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;