diff --git a/server/console.c b/server/console.c index 2ca6bd4..ea262fd 100644 --- a/server/console.c +++ b/server/console.c @@ -481,6 +481,17 @@ int free_console( struct process *process ) return 1; } +void close_console( struct process* process) +{ + struct console_input* console = process->console; + + if (console && console_input_is_bare(console) && --console->num_proc == 0) + { + process->console = NULL; + release_object(console); + } +} + /* let process inherit the console from parent... this handle two cases : * 1/ generic console inheritance * 2/ parent is a renderer which launches process, and process should attach to the console diff --git a/server/process.c b/server/process.c index a3aa586..10f4bd7 100644 --- a/server/process.c +++ b/server/process.c @@ -566,6 +566,7 @@ static void terminate_process( struct process *process, struct thread *skip, int struct thread *thread; grab_object( process ); /* make sure it doesn't get freed when threads die */ + close_bare_console( process ); restart: LIST_FOR_EACH_ENTRY( thread, &process->thread_list, struct thread, proc_entry ) { diff --git a/server/process.h b/server/process.h index cee7be9..e8546e6 100644 --- a/server/process.h +++ b/server/process.h @@ -126,6 +126,7 @@ extern void enum_processes( int (*cb)(struct process*, void*), void *user); /* console functions */ extern void inherit_console(struct thread *parent_thread, struct process *process, obj_handle_t hconin); extern int free_console( struct process *process ); +extern int close_bare_console( struct process *process ); extern struct thread *console_get_renderer( struct console_input *console ); /* process tracing mechanism to use */