Module: wine Branch: master Commit: 538b24747cdadf7e8e3082911868502b2fc433b9 URL: http://source.winehq.org/git/wine.git/?a=commit;h=538b24747cdadf7e8e30829118...
Author: Alexandre Julliard julliard@winehq.org Date: Thu Oct 15 17:56:04 2009 +0200
server: Free client-side user handles at process exit.
---
server/process.c | 1 + server/user.c | 12 +++++++++++- server/user.h | 1 + 3 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/server/process.c b/server/process.c index 31d3527..630abe6 100644 --- a/server/process.c +++ b/server/process.c @@ -645,6 +645,7 @@ static void process_killed( struct process *process ) free( dll ); } destroy_process_classes( process ); + free_process_user_handles( process ); remove_process_locks( process ); set_process_startup_state( process, STARTUP_ABORTED ); finish_process_tracing( process ); diff --git a/server/user.c b/server/user.c index 2515799..c529fc7 100644 --- a/server/user.c +++ b/server/user.c @@ -166,10 +166,20 @@ void *next_user_handle( user_handle_t *handle, enum user_object type ) return NULL; }
+/* free client-side user handles managed by the process */ +void free_process_user_handles( struct process *process ) +{ + unsigned int i; + + for (i = 0; i < nb_handles; i++) + if (handles[i].type == USER_CLIENT && handles[i].ptr == process) + free_user_entry( &handles[i] ); +} + /* allocate an arbitrary user handle */ DECL_HANDLER(alloc_user_handle) { - reply->handle = alloc_user_handle( NULL, USER_CLIENT ); + reply->handle = alloc_user_handle( current->process, USER_CLIENT ); }
diff --git a/server/user.h b/server/user.h index bf1e23c..e9ad116 100644 --- a/server/user.h +++ b/server/user.h @@ -72,6 +72,7 @@ extern void *get_user_object_handle( user_handle_t *handle, enum user_object typ extern user_handle_t get_user_full_handle( user_handle_t handle ); extern void *free_user_handle( user_handle_t handle ); extern void *next_user_handle( user_handle_t *handle, enum user_object type ); +extern void free_process_user_handles( struct process *process );
/* clipboard functions */