forked from Kron4ek/Wine-Builds
-
Notifications
You must be signed in to change notification settings - Fork 16
/
wineserverdesktopthreading.patch
49 lines (44 loc) · 2.07 KB
/
wineserverdesktopthreading.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
diff --git a/server/winstation.c b/server/winstation.c
index 80126ad..2de6e51 100644
--- a/server/winstation.c
+++ b/server/winstation.c
@@ -403,24 +403,21 @@ static void add_desktop_thread( struct desktop *desktop, struct thread *thread )
}
/* remove a user of the desktop and start the close timeout if necessary */
-static void remove_desktop_user( struct desktop *desktop, struct thread *thread )
+static void remove_desktop_thread( struct desktop *desktop, struct thread *thread )
{
struct process *process;
- assert( desktop->users > 0 );
- desktop->users--;
-
- /* 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)
- desktop->close_timeout = add_timeout_user( -TICKS_PER_SEC, close_desktop_timeout, desktop );
-}
-
-/* remove a thread from the list of threads attached to a desktop */
-static void remove_desktop_thread( struct desktop *desktop, struct thread *thread )
-{
list_remove( &thread->desktop_entry );
- if (!thread->process->is_system) remove_desktop_user( desktop, thread );
+ if (!thread->process->is_system)
+ {
+ assert( desktop->users > 0 );
+ desktop->users--;
+
+/* 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)
+ desktop->close_timeout = add_timeout_user( -TICKS_PER_SEC, close_desktop_timeout, desktop );
+ }
if (desktop == desktop->winstation->input_desktop)
{
@@ -549,8 +546,7 @@ void release_thread_desktop( struct thread *thread, int close )
if (!(desktop = get_desktop_obj( thread->process, handle, 0 ))) clear_error(); /* ignore errors */
else
{
- if (close) remove_desktop_thread( desktop, thread );
- else remove_desktop_user( desktop, thread );
+ remove_desktop_thread( desktop, thread );
release_object( desktop );
}