Remove an exiting thread from the process only after thread cleanup to
avoid accessing freed window classes.
diff --git a/server/thread.c b/server/thread.c
index e2de1c4..bddabb0 100644
--- a/server/thread.c
+++ b/server/thread.c
@@ -764,10 +764,10 @@
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 );
}