server: Do not hold reference on parent process.
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
1025ed38c0
commit
bae3dcc295
|
@ -1157,7 +1157,7 @@ static void test_Toolhelp(void)
|
||||||
Sleep(100);
|
Sleep(100);
|
||||||
}
|
}
|
||||||
/* The following test fails randomly on some Windows versions, but Gothic 2 depends on it */
|
/* The following test fails randomly on some Windows versions, but Gothic 2 depends on it */
|
||||||
todo_wine ok(i < 20 || broken(i == 20), "process object not released\n");
|
ok(i < 20 || broken(i == 20), "process object not released\n");
|
||||||
|
|
||||||
snapshot = pCreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
|
snapshot = pCreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
|
||||||
ok(snapshot != INVALID_HANDLE_VALUE, "CreateToolhelp32Snapshot failed %u\n", GetLastError());
|
ok(snapshot != INVALID_HANDLE_VALUE, "CreateToolhelp32Snapshot failed %u\n", GetLastError());
|
||||||
|
|
|
@ -1424,13 +1424,12 @@ DECL_HANDLER(alloc_console)
|
||||||
case 0:
|
case 0:
|
||||||
/* renderer is current, console to be attached to parent process */
|
/* renderer is current, console to be attached to parent process */
|
||||||
renderer = current;
|
renderer = current;
|
||||||
if (!(process = current->process->parent))
|
if (!(process = get_process_from_id( current->process->parent_id )))
|
||||||
{
|
{
|
||||||
if (fd != -1) close( fd );
|
if (fd != -1) close( fd );
|
||||||
set_error( STATUS_ACCESS_DENIED );
|
set_error( STATUS_ACCESS_DENIED );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
grab_object( process );
|
|
||||||
attach = 1;
|
attach = 1;
|
||||||
break;
|
break;
|
||||||
case 0xffffffff:
|
case 0xffffffff:
|
||||||
|
|
|
@ -506,7 +506,7 @@ struct thread *create_process( int fd, struct thread *parent_thread, int inherit
|
||||||
close( fd );
|
close( fd );
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
process->parent = NULL;
|
process->parent_id = 0;
|
||||||
process->debugger = NULL;
|
process->debugger = NULL;
|
||||||
process->handles = NULL;
|
process->handles = NULL;
|
||||||
process->msg_fd = NULL;
|
process->msg_fd = NULL;
|
||||||
|
@ -558,7 +558,7 @@ struct thread *create_process( int fd, struct thread *parent_thread, int inherit
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
struct process *parent = parent_thread->process;
|
struct process *parent = parent_thread->process;
|
||||||
process->parent = (struct process *)grab_object( parent );
|
process->parent_id = parent->id;
|
||||||
process->handles = inherit_all ? copy_handle_table( process, parent )
|
process->handles = inherit_all ? copy_handle_table( process, parent )
|
||||||
: alloc_handle_table( process, 0 );
|
: alloc_handle_table( process, 0 );
|
||||||
/* Note: for security reasons, starting a new process does not attempt
|
/* Note: for security reasons, starting a new process does not attempt
|
||||||
|
@ -625,7 +625,6 @@ static void process_destroy( struct object *obj )
|
||||||
release_object( process->job );
|
release_object( process->job );
|
||||||
}
|
}
|
||||||
if (process->console) release_object( process->console );
|
if (process->console) release_object( process->console );
|
||||||
if (process->parent) release_object( process->parent );
|
|
||||||
if (process->msg_fd) release_object( process->msg_fd );
|
if (process->msg_fd) release_object( process->msg_fd );
|
||||||
list_remove( &process->entry );
|
list_remove( &process->entry );
|
||||||
if (process->idle_event) release_object( process->idle_event );
|
if (process->idle_event) release_object( process->idle_event );
|
||||||
|
@ -1354,7 +1353,7 @@ DECL_HANDLER(get_process_info)
|
||||||
if ((process = get_process_from_handle( req->handle, PROCESS_QUERY_LIMITED_INFORMATION )))
|
if ((process = get_process_from_handle( req->handle, PROCESS_QUERY_LIMITED_INFORMATION )))
|
||||||
{
|
{
|
||||||
reply->pid = get_process_id( process );
|
reply->pid = get_process_id( process );
|
||||||
reply->ppid = process->parent ? get_process_id( process->parent ) : 0;
|
reply->ppid = process->parent_id;
|
||||||
reply->exit_code = process->exit_code;
|
reply->exit_code = process->exit_code;
|
||||||
reply->priority = process->priority;
|
reply->priority = process->priority;
|
||||||
reply->affinity = process->affinity;
|
reply->affinity = process->affinity;
|
||||||
|
|
|
@ -56,7 +56,7 @@ struct process
|
||||||
{
|
{
|
||||||
struct object obj; /* object header */
|
struct object obj; /* object header */
|
||||||
struct list entry; /* entry in system-wide process list */
|
struct list entry; /* entry in system-wide process list */
|
||||||
struct process *parent; /* parent process */
|
process_id_t parent_id; /* parent process id (at the time of creation) */
|
||||||
struct list thread_list; /* thread list */
|
struct list thread_list; /* thread list */
|
||||||
struct thread *debugger; /* thread debugging this process */
|
struct thread *debugger; /* thread debugging this process */
|
||||||
struct handle_table *handles; /* handle entries */
|
struct handle_table *handles; /* handle entries */
|
||||||
|
|
|
@ -115,7 +115,7 @@ static int snapshot_next_process( struct snapshot *snapshot, struct next_process
|
||||||
ptr = &snapshot->processes[snapshot->process_pos++];
|
ptr = &snapshot->processes[snapshot->process_pos++];
|
||||||
reply->count = ptr->count;
|
reply->count = ptr->count;
|
||||||
reply->pid = get_process_id( ptr->process );
|
reply->pid = get_process_id( ptr->process );
|
||||||
reply->ppid = ptr->process->parent ? get_process_id( ptr->process->parent ) : 0;
|
reply->ppid = ptr->process->parent_id;
|
||||||
reply->threads = ptr->threads;
|
reply->threads = ptr->threads;
|
||||||
reply->priority = ptr->priority;
|
reply->priority = ptr->priority;
|
||||||
reply->handles = ptr->handles;
|
reply->handles = ptr->handles;
|
||||||
|
|
|
@ -1304,7 +1304,7 @@ DECL_HANDLER(init_thread)
|
||||||
process->peb = req->entry;
|
process->peb = req->entry;
|
||||||
process->cpu = req->cpu;
|
process->cpu = req->cpu;
|
||||||
reply->info_size = init_process( current );
|
reply->info_size = init_process( current );
|
||||||
if (!process->parent)
|
if (!process->parent_id)
|
||||||
process->affinity = current->affinity = get_thread_affinity( current );
|
process->affinity = current->affinity = get_thread_affinity( current );
|
||||||
else
|
else
|
||||||
set_thread_affinity( current, current->affinity );
|
set_thread_affinity( current, current->affinity );
|
||||||
|
|
Loading…
Reference in New Issue