From 6f916be5c821d6f319c9047fed9981d1e840c2b1 Mon Sep 17 00:00:00 2001 From: Rodrigo Kumpera Date: Tue, 26 Nov 2013 15:40:46 -0500 Subject: [PATCH] [runtime] Protect MonoImage::generic_def_objects with the image lock and not the loader lock. --- mono/metadata/icall.c | 4 ++-- mono/metadata/reflection.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/mono/metadata/icall.c b/mono/metadata/icall.c index 450d7cd21e6..1112f988d94 100644 --- a/mono/metadata/icall.c +++ b/mono/metadata/icall.c @@ -2668,9 +2668,9 @@ ves_icall_MonoMethod_GetGenericMethodDefinition (MonoReflectionMethod *method) * FIXME: Why is this stuff needed at all ? Why can't the code below work for * the dynamic case as well ? */ - mono_loader_lock (); + mono_image_lock ((MonoImage*)image); res = mono_g_hash_table_lookup (image->generic_def_objects, imethod); - mono_loader_unlock (); + mono_image_unlock ((MonoImage*)image); if (res) return res; diff --git a/mono/metadata/reflection.c b/mono/metadata/reflection.c index 4e7ea49d961..b5d08e12092 100644 --- a/mono/metadata/reflection.c +++ b/mono/metadata/reflection.c @@ -10571,9 +10571,9 @@ mono_reflection_bind_generic_method_parameters (MonoReflectionMethod *rmethod, M * This table maps metadata structures representing inflated methods/fields * to the reflection objects representing their generic definitions. */ - mono_loader_lock (); + mono_image_lock ((MonoImage*)image); mono_g_hash_table_insert (image->generic_def_objects, imethod, rmethod); - mono_loader_unlock (); + mono_image_unlock ((MonoImage*)image); } if (!mono_verifier_is_method_valid_generic_instantiation (inflated)) @@ -10617,9 +10617,9 @@ inflate_mono_method (MonoClass *klass, MonoMethod *method, MonoObject *obj) if (method->is_generic && method->klass->image->dynamic) { MonoDynamicImage *image = (MonoDynamicImage*)method->klass->image; - mono_loader_lock (); + mono_image_lock ((MonoImage*)image); mono_g_hash_table_insert (image->generic_def_objects, imethod, obj); - mono_loader_unlock (); + mono_image_unlock ((MonoImage*)image); } return (MonoMethod *) imethod; } -- 2.25.1