diff options
-rw-r--r-- | mono/metadata/cominterop.c | 16 | ||||
-rw-r--r-- | mono/metadata/cominterop.h | 3 | ||||
-rw-r--r-- | mono/metadata/remoting.c | 2 |
3 files changed, 20 insertions, 1 deletions
diff --git a/mono/metadata/cominterop.c b/mono/metadata/cominterop.c index 162e7436406..15007be0d5b 100644 --- a/mono/metadata/cominterop.c +++ b/mono/metadata/cominterop.c @@ -170,6 +170,22 @@ mono_marshal_safearray_set_value (gpointer safearray, gpointer indices, gpointer static void mono_marshal_safearray_free_indices (gpointer indices); +MonoClass* +mono_class_try_get_com_object_class (void) +{ + static MonoClass *tmp_class; + static gboolean inited; + MonoClass *klass; + if (!inited) { + klass = mono_class_from_name (mono_defaults.corlib, "System", "__ComObject"); + mono_memory_barrier (); + tmp_class = klass; + mono_memory_barrier (); + inited = TRUE; + } + return tmp_class; +} + /** * cominterop_method_signature: * @method: a method diff --git a/mono/metadata/cominterop.h b/mono/metadata/cominterop.h index 6a15374f16c..1338bd3b5bc 100644 --- a/mono/metadata/cominterop.h +++ b/mono/metadata/cominterop.h @@ -53,4 +53,7 @@ mono_string_from_bstr (gpointer bstr); MONO_API void mono_free_bstr (gpointer bstr); +MonoClass* +mono_class_try_get_com_object_class (void); + #endif /* __MONO_COMINTEROP_H__ */ diff --git a/mono/metadata/remoting.c b/mono/metadata/remoting.c index 8ca8ae62fdb..6e84ab7c0c4 100644 --- a/mono/metadata/remoting.c +++ b/mono/metadata/remoting.c @@ -408,7 +408,7 @@ mono_marshal_get_remoting_invoke (MonoMethod *method) /* this seems to be the best plase to put this, as all remoting invokes seem to get filtered through here */ #ifndef DISABLE_COM - if (mono_class_is_com_object (method->klass) || method->klass == mono_class_get_com_object_class ()) { + if (mono_class_is_com_object (method->klass) || method->klass == mono_class_try_get_com_object_class ()) { MonoVTable *vtable = mono_class_vtable (mono_domain_get (), method->klass); g_assert (vtable); /*FIXME do proper error handling*/ |