Keep track of the windows and hooks used by a thread to properly
refuse to change the thread desktop when it's in use.
diff --git a/server/window.c b/server/window.c
index 20775f2..9904c39 100644
--- a/server/window.c
+++ b/server/window.c
@@ -311,6 +311,8 @@
if (win == shell_listview) shell_listview = NULL;
if (win == progman_window) progman_window = NULL;
if (win == taskman_window) taskman_window = NULL;
+ assert( win->thread->desktop_users > 0 );
+ win->thread->desktop_users--;
free_user_handle( win->handle );
destroy_properties( win );
list_remove( &win->entry );
@@ -376,6 +378,7 @@
/* put it on parent unlinked list */
if (parent) list_add_head( &parent->unlinked, &win->entry );
+ current->desktop_users++;
return win;
failed:
@@ -1303,6 +1306,7 @@
if (!top_window)
{
if (!(top_window = create_window( NULL, NULL, req->atom, req->instance ))) return;
+ current->desktop_users--;
top_window->thread = NULL; /* no thread owns the desktop */
top_window->style = WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
}