mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-11-21 16:46:54 -08:00
server-Desktop_Refcount: Remove patch set.
This was first added in 78db8b7950
with the
message "Added patch to fix possible leak of explorer.exe processes and
implement proper desktop refcounting." The message of course suggests that
even then no application was known that actually depended on this.
In practice this seems wrong, also: once all non-system processes other than
explorer have terminated, the only way explorer.exe can remain alive is if a
system process holds a reference to explorer. The only relevant system
processes are services, and services cannot display a GUI [this is enforced
since Vista], so this should never be the case.
This commit is contained in:
parent
7fc716aa5f
commit
71ac12a8e3
@ -6,5 +6,4 @@ Depends: server-Realtime_Priority
|
||||
Depends: advapi32-Token_Integrity_Level
|
||||
Depends: ntdll-Junction_Points
|
||||
Depends: user32-rawinput-mouse
|
||||
Depends: server-Desktop_Refcount
|
||||
Disabled: true
|
@ -1,729 +0,0 @@
|
||||
From a40b6ca0906eb4723a51ebe0066eff54f6b1fe51 Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Fri, 4 Dec 2015 10:36:47 +0100
|
||||
Subject: [PATCH] server: Introduce a new alloc_handle object callback. (v2)
|
||||
|
||||
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
|
||||
---
|
||||
server/async.c | 2 ++
|
||||
server/atom.c | 1 +
|
||||
server/change.c | 1 +
|
||||
server/clipboard.c | 1 +
|
||||
server/completion.c | 1 +
|
||||
server/console.c | 5 +++++
|
||||
server/debugger.c | 2 ++
|
||||
server/device.c | 4 ++++
|
||||
server/directory.c | 2 ++
|
||||
server/event.c | 2 ++
|
||||
server/fd.c | 4 ++++
|
||||
server/file.c | 1 +
|
||||
server/handle.c | 13 +++++++++++--
|
||||
server/hook.c | 1 +
|
||||
server/mailslot.c | 4 ++++
|
||||
server/mapping.c | 3 +++
|
||||
server/mutex.c | 1 +
|
||||
server/named_pipe.c | 5 +++++
|
||||
server/object.c | 4 ++++
|
||||
server/object.h | 5 ++++-
|
||||
server/process.c | 3 +++
|
||||
server/queue.c | 2 ++
|
||||
server/registry.c | 1 +
|
||||
server/request.c | 1 +
|
||||
server/semaphore.c | 1 +
|
||||
server/serial.c | 1 +
|
||||
server/signal.c | 1 +
|
||||
server/sock.c | 2 ++
|
||||
server/symlink.c | 1 +
|
||||
server/thread.c | 3 +++
|
||||
server/timer.c | 1 +
|
||||
server/token.c | 1 +
|
||||
server/winstation.c | 2 ++
|
||||
33 files changed, 79 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/server/async.c b/server/async.c
|
||||
index 03994e8fac..9feafd0184 100644
|
||||
--- a/server/async.c
|
||||
+++ b/server/async.c
|
||||
@@ -81,6 +81,7 @@ static const struct object_ops async_ops =
|
||||
NULL, /* unlink_name */
|
||||
no_open_file, /* open_file */
|
||||
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
no_close_handle, /* close_handle */
|
||||
async_destroy /* destroy */
|
||||
};
|
||||
@@ -494,6 +495,7 @@ static const struct object_ops iosb_ops =
|
||||
NULL, /* unlink_name */
|
||||
no_open_file, /* open_file */
|
||||
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
no_close_handle, /* close_handle */
|
||||
iosb_destroy /* destroy */
|
||||
};
|
||||
diff --git a/server/atom.c b/server/atom.c
|
||||
index 57aff7b891..04e301b0bc 100644
|
||||
--- a/server/atom.c
|
||||
+++ b/server/atom.c
|
||||
@@ -91,6 +91,7 @@ static const struct object_ops atom_table_ops =
|
||||
NULL, /* unlink_name */
|
||||
no_open_file, /* open_file */
|
||||
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
no_close_handle, /* close_handle */
|
||||
atom_table_destroy /* destroy */
|
||||
};
|
||||
diff --git a/server/change.c b/server/change.c
|
||||
index a8f3329c72..d0744e72f0 100644
|
||||
--- a/server/change.c
|
||||
+++ b/server/change.c
|
||||
@@ -126,6 +126,7 @@ static const struct object_ops dir_ops =
|
||||
NULL, /* unlink_name */
|
||||
no_open_file, /* open_file */
|
||||
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
dir_close_handle, /* close_handle */
|
||||
dir_destroy /* destroy */
|
||||
};
|
||||
diff --git a/server/clipboard.c b/server/clipboard.c
|
||||
index e6884dd75f..dcc92507bc 100644
|
||||
--- a/server/clipboard.c
|
||||
+++ b/server/clipboard.c
|
||||
@@ -88,6 +88,7 @@ static const struct object_ops clipboard_ops =
|
||||
NULL, /* unlink_name */
|
||||
no_open_file, /* open_file */
|
||||
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
no_close_handle, /* close_handle */
|
||||
clipboard_destroy /* destroy */
|
||||
};
|
||||
diff --git a/server/completion.c b/server/completion.c
|
||||
index db04727b93..e72a155eee 100644
|
||||
--- a/server/completion.c
|
||||
+++ b/server/completion.c
|
||||
@@ -75,6 +75,7 @@ static const struct object_ops completion_ops =
|
||||
default_unlink_name, /* unlink_name */
|
||||
no_open_file, /* open_file */
|
||||
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
no_close_handle, /* close_handle */
|
||||
completion_destroy /* destroy */
|
||||
};
|
||||
diff --git a/server/console.c b/server/console.c
|
||||
index 3ea8a0fe53..16e37b4e88 100644
|
||||
--- a/server/console.c
|
||||
+++ b/server/console.c
|
||||
@@ -102,6 +102,7 @@ static const struct object_ops console_input_ops =
|
||||
NULL, /* unlink_name */
|
||||
console_input_open_file, /* open_file */
|
||||
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
no_close_handle, /* close_handle */
|
||||
console_input_destroy /* destroy */
|
||||
};
|
||||
@@ -160,6 +161,7 @@ static const struct object_ops console_input_events_ops =
|
||||
NULL, /* unlink_name */
|
||||
console_input_events_open_file, /* open_file */
|
||||
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
no_close_handle, /* close_handle */
|
||||
console_input_events_destroy /* destroy */
|
||||
};
|
||||
@@ -226,6 +228,7 @@ static const struct object_ops console_server_ops =
|
||||
NULL, /* unlink_name */
|
||||
console_server_open_file, /* open_file */
|
||||
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
fd_close_handle, /* close_handle */
|
||||
console_server_destroy /* destroy */
|
||||
};
|
||||
@@ -308,6 +311,7 @@ static const struct object_ops screen_buffer_ops =
|
||||
NULL, /* unlink_name */
|
||||
screen_buffer_open_file, /* open_file */
|
||||
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
no_close_handle, /* close_handle */
|
||||
screen_buffer_destroy /* destroy */
|
||||
};
|
||||
@@ -354,6 +358,7 @@ static const struct object_ops console_device_ops =
|
||||
default_unlink_name, /* unlink_name */
|
||||
console_device_open_file, /* open_file */
|
||||
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
no_close_handle, /* close_handle */
|
||||
no_destroy /* destroy */
|
||||
};
|
||||
diff --git a/server/debugger.c b/server/debugger.c
|
||||
index 401ce36a47..b7746d55c0 100644
|
||||
--- a/server/debugger.c
|
||||
+++ b/server/debugger.c
|
||||
@@ -84,6 +84,7 @@ static const struct object_ops debug_event_ops =
|
||||
NULL, /* unlink_name */
|
||||
no_open_file, /* open_file */
|
||||
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
no_close_handle, /* close_handle */
|
||||
debug_event_destroy /* destroy */
|
||||
};
|
||||
@@ -111,6 +112,7 @@ static const struct object_ops debug_ctx_ops =
|
||||
NULL, /* unlink_name */
|
||||
no_open_file, /* open_file */
|
||||
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
no_close_handle, /* close_handle */
|
||||
debug_ctx_destroy /* destroy */
|
||||
};
|
||||
diff --git a/server/device.c b/server/device.c
|
||||
index 01e08f295f..90150e1b25 100644
|
||||
--- a/server/device.c
|
||||
+++ b/server/device.c
|
||||
@@ -79,6 +79,7 @@ static const struct object_ops irp_call_ops =
|
||||
NULL, /* unlink_name */
|
||||
no_open_file, /* open_file */
|
||||
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
no_close_handle, /* close_handle */
|
||||
irp_call_destroy /* destroy */
|
||||
};
|
||||
@@ -118,6 +119,7 @@ static const struct object_ops device_manager_ops =
|
||||
NULL, /* unlink_name */
|
||||
no_open_file, /* open_file */
|
||||
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
no_close_handle, /* close_handle */
|
||||
device_manager_destroy /* destroy */
|
||||
};
|
||||
@@ -161,6 +163,7 @@ static const struct object_ops device_ops =
|
||||
default_unlink_name, /* unlink_name */
|
||||
device_open_file, /* open_file */
|
||||
device_get_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
no_close_handle, /* close_handle */
|
||||
device_destroy /* destroy */
|
||||
};
|
||||
@@ -210,6 +213,7 @@ static const struct object_ops device_file_ops =
|
||||
NULL, /* unlink_name */
|
||||
no_open_file, /* open_file */
|
||||
device_file_get_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
device_file_close_handle, /* close_handle */
|
||||
device_file_destroy /* destroy */
|
||||
};
|
||||
diff --git a/server/directory.c b/server/directory.c
|
||||
index 198fc48ece..b735602a80 100644
|
||||
--- a/server/directory.c
|
||||
+++ b/server/directory.c
|
||||
@@ -68,6 +68,7 @@ static const struct object_ops object_type_ops =
|
||||
default_unlink_name, /* unlink_name */
|
||||
no_open_file, /* open_file */
|
||||
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
no_close_handle, /* close_handle */
|
||||
no_destroy /* destroy */
|
||||
};
|
||||
@@ -104,6 +105,7 @@ static const struct object_ops directory_ops =
|
||||
default_unlink_name, /* unlink_name */
|
||||
no_open_file, /* open_file */
|
||||
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
no_close_handle, /* close_handle */
|
||||
directory_destroy /* destroy */
|
||||
};
|
||||
diff --git a/server/event.c b/server/event.c
|
||||
index d339d85aa4..a78d73d9e7 100644
|
||||
--- a/server/event.c
|
||||
+++ b/server/event.c
|
||||
@@ -71,6 +71,7 @@ static const struct object_ops event_ops =
|
||||
default_unlink_name, /* unlink_name */
|
||||
no_open_file, /* open_file */
|
||||
event_get_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
no_close_handle, /* close_handle */
|
||||
no_destroy /* destroy */
|
||||
};
|
||||
@@ -105,6 +106,7 @@ static const struct object_ops keyed_event_ops =
|
||||
default_unlink_name, /* unlink_name */
|
||||
no_open_file, /* open_file */
|
||||
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
no_close_handle, /* close_handle */
|
||||
no_destroy /* destroy */
|
||||
};
|
||||
diff --git a/server/fd.c b/server/fd.c
|
||||
index 7ea8ac273e..a4741724fb 100644
|
||||
--- a/server/fd.c
|
||||
+++ b/server/fd.c
|
||||
@@ -221,6 +221,7 @@ static const struct object_ops fd_ops =
|
||||
NULL, /* unlink_name */
|
||||
no_open_file, /* open_file */
|
||||
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
no_close_handle, /* close_handle */
|
||||
fd_destroy /* destroy */
|
||||
};
|
||||
@@ -261,6 +262,7 @@ static const struct object_ops device_ops =
|
||||
NULL, /* unlink_name */
|
||||
no_open_file, /* open_file */
|
||||
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
no_close_handle, /* close_handle */
|
||||
device_destroy /* destroy */
|
||||
};
|
||||
@@ -300,6 +302,7 @@ static const struct object_ops inode_ops =
|
||||
NULL, /* unlink_name */
|
||||
no_open_file, /* open_file */
|
||||
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
no_close_handle, /* close_handle */
|
||||
inode_destroy /* destroy */
|
||||
};
|
||||
@@ -341,6 +344,7 @@ static const struct object_ops file_lock_ops =
|
||||
NULL, /* unlink_name */
|
||||
no_open_file, /* open_file */
|
||||
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
no_close_handle, /* close_handle */
|
||||
no_destroy /* destroy */
|
||||
};
|
||||
diff --git a/server/file.c b/server/file.c
|
||||
index 38260cfd2b..ba9358c0ee 100644
|
||||
--- a/server/file.c
|
||||
+++ b/server/file.c
|
||||
@@ -96,6 +96,7 @@ static const struct object_ops file_ops =
|
||||
NULL, /* unlink_name */
|
||||
file_open_file, /* open_file */
|
||||
file_get_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
fd_close_handle, /* close_handle */
|
||||
file_destroy /* destroy */
|
||||
};
|
||||
diff --git a/server/handle.c b/server/handle.c
|
||||
index 9ae99cd0c6..5a3a357b99 100644
|
||||
--- a/server/handle.c
|
||||
+++ b/server/handle.c
|
||||
@@ -134,6 +134,7 @@ static const struct object_ops handle_table_ops =
|
||||
NULL, /* unlink_name */
|
||||
no_open_file, /* open_file */
|
||||
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
no_close_handle, /* close_handle */
|
||||
handle_table_destroy /* destroy */
|
||||
};
|
||||
@@ -233,7 +234,7 @@ static int grow_handle_table( struct handle_table *table )
|
||||
}
|
||||
|
||||
/* allocate the first free entry in the handle table */
|
||||
-static obj_handle_t alloc_entry( struct handle_table *table, void *obj, unsigned int access )
|
||||
+static obj_handle_t alloc_entry( struct handle_table *table, struct object *obj, unsigned int access )
|
||||
{
|
||||
struct handle_entry *entry = table->entries + table->free;
|
||||
int i;
|
||||
@@ -249,6 +250,10 @@ static obj_handle_t alloc_entry( struct handle_table *table, void *obj, unsigned
|
||||
table->free = i + 1;
|
||||
entry->ptr = grab_object_for_handle( obj );
|
||||
entry->access = access;
|
||||
+
|
||||
+ if (table->process)
|
||||
+ obj->ops->alloc_handle( obj, table->process, index_to_handle(i) );
|
||||
+
|
||||
return index_to_handle(i);
|
||||
}
|
||||
|
||||
@@ -374,7 +379,11 @@ struct handle_table *copy_handle_table( struct process *process, struct process
|
||||
for (i = 0; i <= table->last; i++, ptr++)
|
||||
{
|
||||
if (!ptr->ptr) continue;
|
||||
- if (ptr->access & RESERVED_INHERIT) grab_object_for_handle( ptr->ptr );
|
||||
+ if (ptr->access & RESERVED_INHERIT)
|
||||
+ {
|
||||
+ ptr->ptr->ops->alloc_handle( ptr->ptr, process, index_to_handle(i) );
|
||||
+ grab_object_for_handle( ptr->ptr );
|
||||
+ }
|
||||
else ptr->ptr = NULL; /* don't inherit this entry */
|
||||
}
|
||||
}
|
||||
diff --git a/server/hook.c b/server/hook.c
|
||||
index ec6be58248..c2a26eb4df 100644
|
||||
--- a/server/hook.c
|
||||
+++ b/server/hook.c
|
||||
@@ -92,6 +92,7 @@ static const struct object_ops hook_table_ops =
|
||||
NULL, /* unlink_name */
|
||||
no_open_file, /* open_file */
|
||||
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
no_close_handle, /* close_handle */
|
||||
hook_table_destroy /* destroy */
|
||||
};
|
||||
diff --git a/server/mailslot.c b/server/mailslot.c
|
||||
index 58d650cbb2..0f8d457f1a 100644
|
||||
--- a/server/mailslot.c
|
||||
+++ b/server/mailslot.c
|
||||
@@ -89,6 +89,7 @@ static const struct object_ops mailslot_ops =
|
||||
default_unlink_name, /* unlink_name */
|
||||
mailslot_open_file, /* open_file */
|
||||
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
fd_close_handle, /* close_handle */
|
||||
mailslot_destroy /* destroy */
|
||||
};
|
||||
@@ -146,6 +147,7 @@ static const struct object_ops mail_writer_ops =
|
||||
NULL, /* unlink_name */
|
||||
no_open_file, /* open_file */
|
||||
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
fd_close_handle, /* close_handle */
|
||||
mail_writer_destroy /* destroy */
|
||||
};
|
||||
@@ -208,6 +210,7 @@ static const struct object_ops mailslot_device_ops =
|
||||
default_unlink_name, /* unlink_name */
|
||||
mailslot_device_open_file, /* open_file */
|
||||
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
no_close_handle, /* close_handle */
|
||||
mailslot_device_destroy /* destroy */
|
||||
};
|
||||
@@ -236,6 +239,7 @@ static const struct object_ops mailslot_device_file_ops =
|
||||
NULL, /* unlink_name */
|
||||
no_open_file, /* open_file */
|
||||
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
fd_close_handle, /* close_handle */
|
||||
mailslot_device_file_destroy /* destroy */
|
||||
};
|
||||
diff --git a/server/mapping.c b/server/mapping.c
|
||||
index db0debe0af..952984381c 100644
|
||||
--- a/server/mapping.c
|
||||
+++ b/server/mapping.c
|
||||
@@ -79,6 +79,7 @@ static const struct object_ops ranges_ops =
|
||||
NULL, /* unlink_name */
|
||||
no_open_file, /* open_file */
|
||||
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
no_close_handle, /* close_handle */
|
||||
ranges_destroy /* destroy */
|
||||
};
|
||||
@@ -114,6 +115,7 @@ static const struct object_ops shared_map_ops =
|
||||
NULL, /* unlink_name */
|
||||
no_open_file, /* open_file */
|
||||
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
no_close_handle, /* close_handle */
|
||||
shared_map_destroy /* destroy */
|
||||
};
|
||||
@@ -171,6 +173,7 @@ static const struct object_ops mapping_ops =
|
||||
default_unlink_name, /* unlink_name */
|
||||
no_open_file, /* open_file */
|
||||
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
fd_close_handle, /* close_handle */
|
||||
mapping_destroy /* destroy */
|
||||
};
|
||||
diff --git a/server/mutex.c b/server/mutex.c
|
||||
index 8a8f7248ea..3754c35acb 100644
|
||||
--- a/server/mutex.c
|
||||
+++ b/server/mutex.c
|
||||
@@ -72,6 +72,7 @@ static const struct object_ops mutex_ops =
|
||||
default_unlink_name, /* unlink_name */
|
||||
no_open_file, /* open_file */
|
||||
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
no_close_handle, /* close_handle */
|
||||
mutex_destroy /* destroy */
|
||||
};
|
||||
diff --git a/server/named_pipe.c b/server/named_pipe.c
|
||||
index e7e5436c0e..2636849e45 100644
|
||||
--- a/server/named_pipe.c
|
||||
+++ b/server/named_pipe.c
|
||||
@@ -129,6 +129,7 @@ static const struct object_ops named_pipe_ops =
|
||||
default_unlink_name, /* unlink_name */
|
||||
named_pipe_open_file, /* open_file */
|
||||
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
no_close_handle, /* close_handle */
|
||||
named_pipe_destroy /* destroy */
|
||||
};
|
||||
@@ -171,6 +172,7 @@ static const struct object_ops pipe_server_ops =
|
||||
NULL, /* unlink_name */
|
||||
no_open_file, /* open_file */
|
||||
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
fd_close_handle, /* close_handle */
|
||||
pipe_server_destroy /* destroy */
|
||||
};
|
||||
@@ -213,6 +215,7 @@ static const struct object_ops pipe_client_ops =
|
||||
NULL, /* unlink_name */
|
||||
no_open_file, /* open_file */
|
||||
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
fd_close_handle, /* close_handle */
|
||||
pipe_end_destroy /* destroy */
|
||||
};
|
||||
@@ -259,6 +262,7 @@ static const struct object_ops named_pipe_device_ops =
|
||||
default_unlink_name, /* unlink_name */
|
||||
named_pipe_device_open_file, /* open_file */
|
||||
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
no_close_handle, /* close_handle */
|
||||
named_pipe_device_destroy /* destroy */
|
||||
};
|
||||
@@ -288,6 +292,7 @@ static const struct object_ops named_pipe_device_file_ops =
|
||||
NULL, /* unlink_name */
|
||||
no_open_file, /* open_file */
|
||||
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
fd_close_handle, /* close_handle */
|
||||
named_pipe_device_file_destroy /* destroy */
|
||||
};
|
||||
diff --git a/server/object.c b/server/object.c
|
||||
index 8ec6609f69..c319cfc487 100644
|
||||
--- a/server/object.c
|
||||
+++ b/server/object.c
|
||||
@@ -711,6 +711,10 @@ struct object *no_open_file( struct object *obj, unsigned int access, unsigned i
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+void no_alloc_handle( struct object *obj, struct process *process, obj_handle_t handle )
|
||||
+{
|
||||
+}
|
||||
+
|
||||
int no_close_handle( struct object *obj, struct process *process, obj_handle_t handle )
|
||||
{
|
||||
return 1; /* ok to close */
|
||||
diff --git a/server/object.h b/server/object.h
|
||||
index 1f5c4a5f06..d47abbc3e4 100644
|
||||
--- a/server/object.h
|
||||
+++ b/server/object.h
|
||||
@@ -91,8 +91,10 @@ struct object_ops
|
||||
unsigned int options);
|
||||
/* return list of kernel objects */
|
||||
struct list *(*get_kernel_obj_list)(struct object *);
|
||||
+ /* allocate a handle to this object */
|
||||
+ void (*alloc_handle)(struct object *, struct process *, obj_handle_t);
|
||||
/* close a handle to this object */
|
||||
- int (*close_handle)(struct object *,struct process *,obj_handle_t);
|
||||
+ int (*close_handle)(struct object *, struct process *, obj_handle_t);
|
||||
/* destroy on refcount == 0 */
|
||||
void (*destroy)(struct object *);
|
||||
};
|
||||
@@ -170,6 +172,7 @@ extern void default_unlink_name( struct object *obj, struct object_name *name );
|
||||
extern struct object *no_open_file( struct object *obj, unsigned int access, unsigned int sharing,
|
||||
unsigned int options );
|
||||
extern struct list *no_kernel_obj_list( struct object *obj );
|
||||
+extern void no_alloc_handle( struct object *obj, struct process *process, obj_handle_t handle );
|
||||
extern int no_close_handle( struct object *obj, struct process *process, obj_handle_t handle );
|
||||
extern void no_destroy( struct object *obj );
|
||||
#ifdef DEBUG_OBJECTS
|
||||
diff --git a/server/process.c b/server/process.c
|
||||
index 9bf5e447d3..85856da885 100644
|
||||
--- a/server/process.c
|
||||
+++ b/server/process.c
|
||||
@@ -89,6 +89,7 @@ static const struct object_ops process_ops =
|
||||
NULL, /* unlink_name */
|
||||
no_open_file, /* open_file */
|
||||
process_get_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
no_close_handle, /* close_handle */
|
||||
process_destroy /* destroy */
|
||||
};
|
||||
@@ -139,6 +140,7 @@ static const struct object_ops startup_info_ops =
|
||||
NULL, /* unlink_name */
|
||||
no_open_file, /* open_file */
|
||||
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
no_close_handle, /* close_handle */
|
||||
startup_info_destroy /* destroy */
|
||||
};
|
||||
@@ -184,6 +186,7 @@ static const struct object_ops job_ops =
|
||||
default_unlink_name, /* unlink_name */
|
||||
no_open_file, /* open_file */
|
||||
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
job_close_handle, /* close_handle */
|
||||
job_destroy /* destroy */
|
||||
};
|
||||
diff --git a/server/queue.c b/server/queue.c
|
||||
index c101601605..5b1a57fe0a 100644
|
||||
--- a/server/queue.c
|
||||
+++ b/server/queue.c
|
||||
@@ -182,6 +182,7 @@ static const struct object_ops msg_queue_ops =
|
||||
NULL, /* unlink_name */
|
||||
no_open_file, /* open_file */
|
||||
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
no_close_handle, /* close_handle */
|
||||
msg_queue_destroy /* destroy */
|
||||
};
|
||||
@@ -218,6 +219,7 @@ static const struct object_ops thread_input_ops =
|
||||
NULL, /* unlink_name */
|
||||
no_open_file, /* open_file */
|
||||
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
no_close_handle, /* close_handle */
|
||||
thread_input_destroy /* destroy */
|
||||
};
|
||||
diff --git a/server/registry.c b/server/registry.c
|
||||
index dcbb3f791e..6e5eddcd25 100644
|
||||
--- a/server/registry.c
|
||||
+++ b/server/registry.c
|
||||
@@ -170,6 +170,7 @@ static const struct object_ops key_ops =
|
||||
NULL, /* unlink_name */
|
||||
no_open_file, /* open_file */
|
||||
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
key_close_handle, /* close_handle */
|
||||
key_destroy /* destroy */
|
||||
};
|
||||
diff --git a/server/request.c b/server/request.c
|
||||
index 4c1f30a5fe..42cc83c303 100644
|
||||
--- a/server/request.c
|
||||
+++ b/server/request.c
|
||||
@@ -107,6 +107,7 @@ static const struct object_ops master_socket_ops =
|
||||
NULL, /* unlink_name */
|
||||
no_open_file, /* open_file */
|
||||
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
no_close_handle, /* close_handle */
|
||||
master_socket_destroy /* destroy */
|
||||
};
|
||||
diff --git a/server/semaphore.c b/server/semaphore.c
|
||||
index 6e2415fd79..457cd6f455 100644
|
||||
--- a/server/semaphore.c
|
||||
+++ b/server/semaphore.c
|
||||
@@ -69,6 +69,7 @@ static const struct object_ops semaphore_ops =
|
||||
default_unlink_name, /* unlink_name */
|
||||
no_open_file, /* open_file */
|
||||
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
no_close_handle, /* close_handle */
|
||||
no_destroy /* destroy */
|
||||
};
|
||||
diff --git a/server/serial.c b/server/serial.c
|
||||
index 4292472613..ecb9a9350a 100644
|
||||
--- a/server/serial.c
|
||||
+++ b/server/serial.c
|
||||
@@ -103,6 +103,7 @@ static const struct object_ops serial_ops =
|
||||
NULL, /* unlink_name */
|
||||
no_open_file, /* open_file */
|
||||
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
fd_close_handle, /* close_handle */
|
||||
serial_destroy /* destroy */
|
||||
};
|
||||
diff --git a/server/signal.c b/server/signal.c
|
||||
index c81f6b8e98..b8dd87d86f 100644
|
||||
--- a/server/signal.c
|
||||
+++ b/server/signal.c
|
||||
@@ -78,6 +78,7 @@ static const struct object_ops handler_ops =
|
||||
NULL, /* unlink_name */
|
||||
no_open_file, /* open_file */
|
||||
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
no_close_handle, /* close_handle */
|
||||
handler_destroy /* destroy */
|
||||
};
|
||||
diff --git a/server/sock.c b/server/sock.c
|
||||
index 5095a6ef9f..7b10b74cc4 100644
|
||||
--- a/server/sock.c
|
||||
+++ b/server/sock.c
|
||||
@@ -155,6 +155,7 @@ static const struct object_ops sock_ops =
|
||||
NULL, /* unlink_name */
|
||||
no_open_file, /* open_file */
|
||||
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
fd_close_handle, /* close_handle */
|
||||
sock_destroy /* destroy */
|
||||
};
|
||||
@@ -970,6 +971,7 @@ static const struct object_ops ifchange_ops =
|
||||
NULL, /* unlink_name */
|
||||
no_open_file, /* open_file */
|
||||
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
no_close_handle, /* close_handle */
|
||||
ifchange_destroy /* destroy */
|
||||
};
|
||||
diff --git a/server/symlink.c b/server/symlink.c
|
||||
index 7a2f8642d5..7bb28c8d7c 100644
|
||||
--- a/server/symlink.c
|
||||
+++ b/server/symlink.c
|
||||
@@ -71,6 +71,7 @@ static const struct object_ops symlink_ops =
|
||||
default_unlink_name, /* unlink_name */
|
||||
no_open_file, /* open_file */
|
||||
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
no_close_handle, /* close_handle */
|
||||
symlink_destroy /* destroy */
|
||||
};
|
||||
diff --git a/server/thread.c b/server/thread.c
|
||||
index 9b14174578..e3783351eb 100644
|
||||
--- a/server/thread.c
|
||||
+++ b/server/thread.c
|
||||
@@ -121,6 +121,7 @@ static const struct object_ops thread_apc_ops =
|
||||
NULL, /* unlink_name */
|
||||
no_open_file, /* open_file */
|
||||
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
no_close_handle, /* close_handle */
|
||||
thread_apc_destroy /* destroy */
|
||||
};
|
||||
@@ -157,6 +158,7 @@ static const struct object_ops context_ops =
|
||||
NULL, /* unlink_name */
|
||||
no_open_file, /* open_file */
|
||||
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
no_close_handle, /* close_handle */
|
||||
no_destroy /* destroy */
|
||||
};
|
||||
@@ -191,6 +193,7 @@ static const struct object_ops thread_ops =
|
||||
NULL, /* unlink_name */
|
||||
no_open_file, /* open_file */
|
||||
thread_get_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
no_close_handle, /* close_handle */
|
||||
destroy_thread /* destroy */
|
||||
};
|
||||
diff --git a/server/timer.c b/server/timer.c
|
||||
index 6460acbf51..2b5ae29a45 100644
|
||||
--- a/server/timer.c
|
||||
+++ b/server/timer.c
|
||||
@@ -76,6 +76,7 @@ static const struct object_ops timer_ops =
|
||||
default_unlink_name, /* unlink_name */
|
||||
no_open_file, /* open_file */
|
||||
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
no_close_handle, /* close_handle */
|
||||
timer_destroy /* destroy */
|
||||
};
|
||||
diff --git a/server/token.c b/server/token.c
|
||||
index 2fa95e17aa..8464eaf83e 100644
|
||||
--- a/server/token.c
|
||||
+++ b/server/token.c
|
||||
@@ -157,6 +157,7 @@ static const struct object_ops token_ops =
|
||||
NULL, /* unlink_name */
|
||||
no_open_file, /* open_file */
|
||||
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
no_close_handle, /* close_handle */
|
||||
token_destroy /* destroy */
|
||||
};
|
||||
diff --git a/server/winstation.c b/server/winstation.c
|
||||
index 2962ea0df4..79a38d4069 100644
|
||||
--- a/server/winstation.c
|
||||
+++ b/server/winstation.c
|
||||
@@ -75,6 +75,7 @@ static const struct object_ops winstation_ops =
|
||||
default_unlink_name, /* unlink_name */
|
||||
no_open_file, /* open_file */
|
||||
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
winstation_close_handle, /* close_handle */
|
||||
winstation_destroy /* destroy */
|
||||
};
|
||||
@@ -99,6 +100,7 @@ static const struct object_ops desktop_ops =
|
||||
default_unlink_name, /* unlink_name */
|
||||
no_open_file, /* open_file */
|
||||
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||
+ no_alloc_handle, /* alloc_handle */
|
||||
desktop_close_handle, /* close_handle */
|
||||
desktop_destroy /* destroy */
|
||||
};
|
||||
--
|
||||
2.28.0
|
||||
|
@ -1,266 +0,0 @@
|
||||
From 7d35e2176637947cd0d8072830408db42a4037d8 Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Fri, 4 Dec 2015 01:22:29 +0100
|
||||
Subject: [PATCH] server: Track desktop handle count more correctly.
|
||||
|
||||
Desktop objects should stay valid, as long as there is a handle from a
|
||||
(non-system) process. Counting only process->desktop references is not
|
||||
sufficient in practice, and causes explorer.exe process leaks.
|
||||
|
||||
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
|
||||
---
|
||||
programs/explorer/desktop.c | 18 +++++++-
|
||||
server/handle.c | 3 +-
|
||||
server/handle.h | 2 +-
|
||||
server/process.c | 1 -
|
||||
server/sock.c | 2 +-
|
||||
server/winstation.c | 88 +++++++++++++++++++------------------
|
||||
6 files changed, 66 insertions(+), 48 deletions(-)
|
||||
|
||||
diff --git a/programs/explorer/desktop.c b/programs/explorer/desktop.c
|
||||
index 2857fcfca..f45bd9d43 100644
|
||||
--- a/programs/explorer/desktop.c
|
||||
+++ b/programs/explorer/desktop.c
|
||||
@@ -34,6 +34,8 @@
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(explorer);
|
||||
|
||||
+extern HANDLE CDECL __wine_make_process_system(void);
|
||||
+
|
||||
#define DESKTOP_CLASS_ATOM ((LPCWSTR)MAKEINTATOM(32769))
|
||||
#define DESKTOP_ALL_ACCESS 0x01ff
|
||||
|
||||
@@ -1009,8 +1011,22 @@ void manage_desktop( WCHAR *arg )
|
||||
/* run the desktop message loop */
|
||||
if (hwnd)
|
||||
{
|
||||
+ HANDLE exit_event = __wine_make_process_system();
|
||||
WINE_TRACE( "desktop message loop starting on hwnd %p\n", hwnd );
|
||||
- while (GetMessageW( &msg, 0, 0, 0 )) DispatchMessageW( &msg );
|
||||
+ while (exit_event != NULL && MsgWaitForMultipleObjectsEx( 1,
|
||||
+ &exit_event, INFINITE, QS_ALLINPUT, 0 ) == WAIT_OBJECT_0 + 1)
|
||||
+ {
|
||||
+ while (PeekMessageW( &msg, NULL, 0, 0, PM_REMOVE ))
|
||||
+ {
|
||||
+ if (msg.message == WM_QUIT)
|
||||
+ {
|
||||
+ exit_event = NULL;
|
||||
+ break;
|
||||
+ }
|
||||
+ TranslateMessage( &msg );
|
||||
+ DispatchMessageW( &msg );
|
||||
+ }
|
||||
+ }
|
||||
WINE_TRACE( "desktop message loop exiting for hwnd %p\n", hwnd );
|
||||
}
|
||||
|
||||
diff --git a/server/handle.c b/server/handle.c
|
||||
index 879098aee..0aa5aa52b 100644
|
||||
--- a/server/handle.c
|
||||
+++ b/server/handle.c
|
||||
@@ -499,7 +499,7 @@ obj_handle_t find_inherited_handle( struct process *process, const struct object
|
||||
/* enumerate handles of a given type */
|
||||
/* this is needed for window stations and desktops */
|
||||
obj_handle_t enumerate_handles( struct process *process, const struct object_ops *ops,
|
||||
- unsigned int *index )
|
||||
+ obj_handle_t *index, struct object **obj )
|
||||
{
|
||||
struct handle_table *table = process->handles;
|
||||
unsigned int i;
|
||||
@@ -512,6 +512,7 @@ obj_handle_t enumerate_handles( struct process *process, const struct object_ops
|
||||
if (!entry->ptr) continue;
|
||||
if (entry->ptr->ops != ops) continue;
|
||||
*index = i + 1;
|
||||
+ if (obj) *obj = grab_object( entry->ptr );
|
||||
return index_to_handle(i);
|
||||
}
|
||||
return 0;
|
||||
diff --git a/server/handle.h b/server/handle.h
|
||||
index f1deb79fb..13478368f 100644
|
||||
--- a/server/handle.h
|
||||
+++ b/server/handle.h
|
||||
@@ -49,7 +49,7 @@ extern obj_handle_t open_object( struct process *process, obj_handle_t parent, u
|
||||
unsigned int attr );
|
||||
extern obj_handle_t find_inherited_handle( struct process *process, const struct object_ops *ops );
|
||||
extern obj_handle_t enumerate_handles( struct process *process, const struct object_ops *ops,
|
||||
- unsigned int *index );
|
||||
+ unsigned int *index, struct object **obj );
|
||||
extern void close_process_handles( struct process *process );
|
||||
extern struct handle_table *alloc_handle_table( struct process *process, int count );
|
||||
extern struct handle_table *copy_handle_table( struct process *process, struct process *parent );
|
||||
diff --git a/server/process.c b/server/process.c
|
||||
index e6568eceb..3221b15da 100644
|
||||
--- a/server/process.c
|
||||
+++ b/server/process.c
|
||||
@@ -899,7 +899,6 @@ static void process_killed( struct process *process )
|
||||
|
||||
assert( list_empty( &process->thread_list ));
|
||||
process->end_time = current_time;
|
||||
- if (!process->is_system) close_process_desktop( process );
|
||||
process->winstation = 0;
|
||||
process->desktop = 0;
|
||||
close_process_handles( process );
|
||||
diff --git a/server/sock.c b/server/sock.c
|
||||
index f951f23d6..d373768c9 100644
|
||||
--- a/server/sock.c
|
||||
+++ b/server/sock.c
|
||||
@@ -1344,6 +1344,6 @@ DECL_HANDLER(socket_cleanup)
|
||||
unsigned int index = 0;
|
||||
obj_handle_t sock;
|
||||
|
||||
- while ((sock = enumerate_handles(current->process, &sock_ops, &index)))
|
||||
+ while ((sock = enumerate_handles(current->process, &sock_ops, &index, NULL)))
|
||||
close_handle(current->process, sock);
|
||||
}
|
||||
diff --git a/server/winstation.c b/server/winstation.c
|
||||
index d7e8a5c80..f9c005496 100644
|
||||
--- a/server/winstation.c
|
||||
+++ b/server/winstation.c
|
||||
@@ -53,6 +53,7 @@ static unsigned int winstation_map_access( struct object *obj, unsigned int acce
|
||||
static void desktop_dump( struct object *obj, int verbose );
|
||||
static struct object_type *desktop_get_type( struct object *obj );
|
||||
static int desktop_link_name( struct object *obj, struct object_name *name, struct object *parent );
|
||||
+static void desktop_alloc_handle( struct object *obj, struct process *process, obj_handle_t handle );
|
||||
static int desktop_close_handle( struct object *obj, struct process *process, obj_handle_t handle );
|
||||
static void desktop_destroy( struct object *obj );
|
||||
static unsigned int desktop_map_access( struct object *obj, unsigned int access );
|
||||
@@ -103,7 +104,7 @@ static const struct object_ops desktop_ops =
|
||||
default_unlink_name, /* unlink_name */
|
||||
no_open_file, /* open_file */
|
||||
no_kernel_obj_list, /* get_kernel_obj_list */
|
||||
- no_alloc_handle, /* alloc_handle */
|
||||
+ desktop_alloc_handle, /* alloc_handle */
|
||||
desktop_close_handle, /* close_handle */
|
||||
desktop_destroy /* destroy */
|
||||
};
|
||||
@@ -275,14 +276,54 @@ static int desktop_link_name( struct object *obj, struct object_name *name, stru
|
||||
return 1;
|
||||
}
|
||||
|
||||
+static void close_desktop_timeout( void *private )
|
||||
+{
|
||||
+ struct desktop *desktop = private;
|
||||
+
|
||||
+ desktop->close_timeout = NULL;
|
||||
+ unlink_named_object( &desktop->obj ); /* make sure no other process can open it */
|
||||
+ post_desktop_message( desktop, WM_CLOSE, 0, 0 ); /* and signal the owner to quit */
|
||||
+}
|
||||
+
|
||||
+/* remove a user of the desktop and start the close timeout if necessary */
|
||||
+static void remove_desktop_user( struct desktop *desktop )
|
||||
+{
|
||||
+ assert( desktop->users > 0 );
|
||||
+ desktop->users--;
|
||||
+
|
||||
+ if (!desktop->users && get_top_window_owner( desktop ))
|
||||
+ {
|
||||
+ assert( !desktop->close_timeout );
|
||||
+ desktop->close_timeout = add_timeout_user( -TICKS_PER_SEC, close_desktop_timeout, desktop );
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void desktop_alloc_handle( struct object *obj, struct process *process, obj_handle_t handle )
|
||||
+{
|
||||
+ struct desktop *desktop = (struct desktop *)obj;
|
||||
+ if (process->is_system) return;
|
||||
+
|
||||
+ desktop->users++;
|
||||
+ if (desktop->close_timeout)
|
||||
+ {
|
||||
+ remove_timeout_user( desktop->close_timeout );
|
||||
+ desktop->close_timeout = NULL;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static int desktop_close_handle( struct object *obj, struct process *process, obj_handle_t handle )
|
||||
{
|
||||
+ struct desktop *desktop = (struct desktop *)obj;
|
||||
struct thread *thread;
|
||||
|
||||
/* check if the handle is currently used by the process or one of its threads */
|
||||
if (process->desktop == handle) return 0;
|
||||
LIST_FOR_EACH_ENTRY( thread, &process->thread_list, struct thread, proc_entry )
|
||||
if (thread->desktop == handle) return 0;
|
||||
+
|
||||
+ if (!process->is_system)
|
||||
+ remove_desktop_user( desktop );
|
||||
+
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -290,6 +331,7 @@ static void desktop_destroy( struct object *obj )
|
||||
{
|
||||
struct desktop *desktop = (struct desktop *)obj;
|
||||
|
||||
+ assert( !desktop->users );
|
||||
free_hotkeys( desktop, 0 );
|
||||
if (desktop->top_window) destroy_window( desktop->top_window );
|
||||
if (desktop->msg_window) destroy_window( desktop->msg_window );
|
||||
@@ -316,40 +358,6 @@ struct desktop *get_thread_desktop( struct thread *thread, unsigned int access )
|
||||
return get_desktop_obj( thread->process, thread->desktop, access );
|
||||
}
|
||||
|
||||
-static void close_desktop_timeout( void *private )
|
||||
-{
|
||||
- struct desktop *desktop = private;
|
||||
-
|
||||
- desktop->close_timeout = NULL;
|
||||
- unlink_named_object( &desktop->obj ); /* make sure no other process can open it */
|
||||
- post_desktop_message( desktop, WM_CLOSE, 0, 0 ); /* and signal the owner to quit */
|
||||
-}
|
||||
-
|
||||
-/* add a user of the desktop and cancel the close timeout */
|
||||
-static void add_desktop_user( struct desktop *desktop )
|
||||
-{
|
||||
- desktop->users++;
|
||||
- if (desktop->close_timeout)
|
||||
- {
|
||||
- remove_timeout_user( desktop->close_timeout );
|
||||
- desktop->close_timeout = NULL;
|
||||
- }
|
||||
-}
|
||||
-
|
||||
-/* remove a user of the desktop and start the close timeout if necessary */
|
||||
-static void remove_desktop_user( struct desktop *desktop )
|
||||
-{
|
||||
- assert( desktop->users > 0 );
|
||||
- desktop->users--;
|
||||
-
|
||||
- /* if we have one remaining user, it has to be the manager of the desktop window */
|
||||
- if (desktop->users == 1 && get_top_window_owner( desktop ))
|
||||
- {
|
||||
- assert( !desktop->close_timeout );
|
||||
- desktop->close_timeout = add_timeout_user( -TICKS_PER_SEC, close_desktop_timeout, desktop );
|
||||
- }
|
||||
-}
|
||||
-
|
||||
/* set the process default desktop handle */
|
||||
void set_process_default_desktop( struct process *process, struct desktop *desktop,
|
||||
obj_handle_t handle )
|
||||
@@ -366,12 +374,6 @@ void set_process_default_desktop( struct process *process, struct desktop *deskt
|
||||
LIST_FOR_EACH_ENTRY( thread, &process->thread_list, struct thread, proc_entry )
|
||||
if (!thread->desktop) thread->desktop = handle;
|
||||
|
||||
- if (!process->is_system && desktop != old_desktop)
|
||||
- {
|
||||
- add_desktop_user( desktop );
|
||||
- if (old_desktop) remove_desktop_user( old_desktop );
|
||||
- }
|
||||
-
|
||||
if (old_desktop) release_object( old_desktop );
|
||||
}
|
||||
|
||||
@@ -421,8 +423,8 @@ done:
|
||||
void close_process_desktop( struct process *process )
|
||||
{
|
||||
struct desktop *desktop;
|
||||
-
|
||||
- if (process->desktop && (desktop = get_desktop_obj( process, process->desktop, 0 )))
|
||||
+ unsigned int i = 0;
|
||||
+ while (enumerate_handles( process, &desktop_ops, &i, (struct object **)&desktop ))
|
||||
{
|
||||
remove_desktop_user( desktop );
|
||||
release_object( desktop );
|
||||
--
|
||||
2.21.0
|
||||
|
@ -1,4 +0,0 @@
|
||||
Fixes: Fix possible leak of explorer.exe processes and implement proper desktop refcounting
|
||||
Fixes: [46967] GOG Galaxy doesn't run in virtual desktop.
|
||||
# Needs work
|
||||
Disabled: true
|
@ -1,6 +1,4 @@
|
||||
Fixes: Report correct ObjectName for NamedPipe wineserver objects
|
||||
# Depends: kernel32-Named_Pipe
|
||||
Depends: server-Desktop_Refcount
|
||||
# This was originally written for msys2's strace.exe. It was broken by
|
||||
# 59dd8ba..6098af8. Since msys2 has been broken in Wine for a while now, this
|
||||
# really isn't worth fixing.
|
||||
|
Loading…
Reference in New Issue
Block a user