Make sure a thread has a queue as soon as it creates a window.

diff --git a/server/queue.c b/server/queue.c
index c2fb9a9..83f908e 100644
--- a/server/queue.c
+++ b/server/queue.c
@@ -282,7 +282,7 @@
 void set_queue_hooks( struct thread *thread, struct hook_table *hooks )
 {
     struct msg_queue *queue = thread->queue;
-    if (!queue) queue = create_msg_queue( thread, NULL );
+    if (!queue && !(queue = create_msg_queue( thread, NULL ))) return;
     if (queue->hooks) release_object( queue->hooks );
     queue->hooks = hooks;
 }
@@ -828,6 +828,13 @@
     return ret;
 }
 
+/* make sure the specified thread has a queue */
+int init_thread_queue( struct thread *thread )
+{
+    if (thread->queue) return 1;
+    return (create_msg_queue( thread, NULL ) != NULL);
+}
+
 /* attach two thread input data structures */
 int attach_thread_input( struct thread *thread_from, struct thread *thread_to )
 {