services: Hold an additional process reference while waiting for startup.

Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Sebastian Lackner 2016-08-11 07:22:55 +02:00 committed by Alexandre Julliard
parent cafcf6448f
commit 049ac1d827
1 changed files with 4 additions and 1 deletions

View File

@ -778,7 +778,7 @@ static DWORD service_start_process(struct service_entry *service_entry, struct p
service_entry->status.dwCurrentState = SERVICE_START_PENDING; service_entry->status.dwCurrentState = SERVICE_START_PENDING;
scmdatabase_add_process(service_entry->db, process); scmdatabase_add_process(service_entry->db, process);
service_entry->process = process; service_entry->process = grab_process(process);
service_unlock(service_entry); service_unlock(service_entry);
@ -788,6 +788,7 @@ static DWORD service_start_process(struct service_entry *service_entry, struct p
{ {
err = GetLastError(); err = GetLastError();
process_terminate(process); process_terminate(process);
release_process(process);
return err; return err;
} }
@ -916,6 +917,8 @@ DWORD service_start(struct service_entry *service, DWORD service_argc, LPCWSTR *
ReleaseMutex(process->control_mutex); ReleaseMutex(process->control_mutex);
else else
process_terminate(process); process_terminate(process);
release_process(process);
} }
scmdatabase_unlock_startup(service->db); scmdatabase_unlock_startup(service->db);