From 867ae269d41f484b243d6543d96ee030e18fd1a1 Mon Sep 17 00:00:00 2001
From: Alexandre Julliard <julliard@winehq.org>
Date: Wed, 14 Sep 2005 15:44:12 +0000
Subject: [PATCH] Remove an exiting thread from the process only after thread
 cleanup to avoid accessing freed window classes.

---
 server/thread.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/server/thread.c b/server/thread.c
index e2de1c4b7c1..bddabb0833d 100644
--- a/server/thread.c
+++ b/server/thread.c
@@ -764,10 +764,10 @@ void kill_thread( struct thread *thread, int violent_death )
     kill_console_processes( thread, 0 );
     debug_exit_thread( thread );
     abandon_mutexes( thread );
-    remove_process_thread( thread->process, thread );
     wake_up( &thread->obj, 0 );
     if (violent_death) send_thread_signal( thread, SIGTERM );
     cleanup_thread( thread );
+    remove_process_thread( thread->process, thread );
     release_object( thread );
 }
 
-- 
GitLab