From d5c972a97b274936d1207c1765a38b053cb89e17 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Henric=20M=C3=BCller?= Date: Thu, 29 Sep 2016 17:19:43 +0200 Subject: [PATCH] Comparing pid instead of handles in GetModules_internal (#3575) Process handles can be different for same process id. Therefore make sure we compare the process ids instead. --- mono/metadata/process.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/mono/metadata/process.c b/mono/metadata/process.c index 8178d283823..96814db8480 100644 --- a/mono/metadata/process.c +++ b/mono/metadata/process.c @@ -489,16 +489,10 @@ ves_icall_System_Diagnostics_Process_GetModules_internal (MonoObject *this_obj, guint32 count = 0, module_count = 0, assembly_count = 0; guint32 i, num_added = 0; GPtrArray *assemblies = NULL; - static HANDLE current_process = 0; - - if (current_process == 0) { - int pid = mono_process_current_pid (); - current_process = ves_icall_System_Diagnostics_Process_GetProcess_internal (pid); - } stash_system_assembly (this_obj); - if (process == current_process) { + if (GetProcessId (process) == mono_process_current_pid ()) { assemblies = get_domain_assemblies (mono_domain_get ()); assembly_count = assemblies->len; } -- 2.25.1