Commit 5d91ab65 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

server: Avoid removing thread twice from its desktop thread list.

parent b13477de
...@@ -403,21 +403,24 @@ static void add_desktop_thread( struct desktop *desktop, struct thread *thread ) ...@@ -403,21 +403,24 @@ static void add_desktop_thread( struct desktop *desktop, struct thread *thread )
} }
/* remove a user of the desktop and start the close timeout if necessary */ /* remove a user of the desktop and start the close timeout if necessary */
static void remove_desktop_thread( struct desktop *desktop, struct thread *thread ) static void remove_desktop_user( struct desktop *desktop, struct thread *thread )
{ {
struct process *process; struct process *process;
list_remove( &thread->desktop_entry ); assert( desktop->users > 0 );
desktop->users--;
if (!thread->process->is_system) /* if we have one remaining user, it has to be the manager of the desktop window */
{ if ((process = get_top_window_owner( desktop )) && desktop->users == process->running_threads && !desktop->close_timeout)
assert( desktop->users > 0 ); desktop->close_timeout = add_timeout_user( -TICKS_PER_SEC, close_desktop_timeout, desktop );
desktop->users--; }
/* if we have one remaining user, it has to be the manager of the desktop window */ /* remove a thread from the list of threads attached to a desktop */
if ((process = get_top_window_owner( desktop )) && desktop->users == process->running_threads && !desktop->close_timeout) static void remove_desktop_thread( struct desktop *desktop, struct thread *thread )
desktop->close_timeout = add_timeout_user( -TICKS_PER_SEC, close_desktop_timeout, desktop ); {
} list_remove( &thread->desktop_entry );
if (!thread->process->is_system) remove_desktop_user( desktop, thread );
if (desktop == desktop->winstation->input_desktop) if (desktop == desktop->winstation->input_desktop)
{ {
...@@ -546,7 +549,8 @@ void release_thread_desktop( struct thread *thread, int close ) ...@@ -546,7 +549,8 @@ void release_thread_desktop( struct thread *thread, int close )
if (!(desktop = get_desktop_obj( thread->process, handle, 0 ))) clear_error(); /* ignore errors */ if (!(desktop = get_desktop_obj( thread->process, handle, 0 ))) clear_error(); /* ignore errors */
else else
{ {
remove_desktop_thread( desktop, thread ); if (close) remove_desktop_thread( desktop, thread );
else remove_desktop_user( desktop, thread );
release_object( desktop ); release_object( desktop );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment