Commit bae3dcc2 authored by Sebastian Lackner's avatar Sebastian Lackner Committed by Alexandre Julliard

server: Do not hold reference on parent process.

parent 1025ed38
......@@ -1157,7 +1157,7 @@ static void test_Toolhelp(void)
Sleep(100);
}
/* 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);
ok(snapshot != INVALID_HANDLE_VALUE, "CreateToolhelp32Snapshot failed %u\n", GetLastError());
......
......@@ -1424,13 +1424,12 @@ DECL_HANDLER(alloc_console)
case 0:
/* renderer is current, console to be attached to parent process */
renderer = current;
if (!(process = current->process->parent))
if (!(process = get_process_from_id( current->process->parent_id )))
{
if (fd != -1) close( fd );
set_error( STATUS_ACCESS_DENIED );
return;
}
grab_object( process );
attach = 1;
break;
case 0xffffffff:
......
......@@ -506,7 +506,7 @@ struct thread *create_process( int fd, struct thread *parent_thread, int inherit
close( fd );
goto error;
}
process->parent = NULL;
process->parent_id = 0;
process->debugger = NULL;
process->handles = NULL;
process->msg_fd = NULL;
......@@ -558,7 +558,7 @@ struct thread *create_process( int fd, struct thread *parent_thread, int inherit
else
{
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 )
: alloc_handle_table( process, 0 );
/* 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 );
}
if (process->console) release_object( process->console );
if (process->parent) release_object( process->parent );
if (process->msg_fd) release_object( process->msg_fd );
list_remove( &process->entry );
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 )))
{
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->priority = process->priority;
reply->affinity = process->affinity;
......
......@@ -56,7 +56,7 @@ struct process
{
struct object obj; /* object header */
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 thread *debugger; /* thread debugging this process */
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++];
reply->count = ptr->count;
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->priority = ptr->priority;
reply->handles = ptr->handles;
......
......@@ -1304,7 +1304,7 @@ DECL_HANDLER(init_thread)
process->peb = req->entry;
process->cpu = req->cpu;
reply->info_size = init_process( current );
if (!process->parent)
if (!process->parent_id)
process->affinity = current->affinity = get_thread_affinity( current );
else
set_thread_affinity( current, current->affinity );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment