[Fix] Ensure that exceptions are propagated when embedding
authorTak <levi@unity3d.com>
Tue, 19 Oct 2010 09:58:36 +0000 (11:58 +0200)
committerZoltan Varga <vargaz@gmail.com>
Tue, 19 Oct 2010 12:17:56 +0000 (14:17 +0200)
* metadata/object.c:
* mini/mini.c:
Ensure that exceptions get propagated back to the caller
when mono is being embedded.
License: MIT/X11

mono/metadata/object.c
mono/mini/mini.c

index 4131cbe07b0c02fed155068169721149bdc99dcc..966c12271ed78677fe69faeaa43b9acf83d87857 100644 (file)
@@ -276,7 +276,9 @@ mono_runtime_class_init_full (MonoVTable *vtable, gboolean raise_exception)
                        MonoVTable *module_vtable = mono_class_vtable_full (vtable->domain, module_klass, raise_exception);
                        if (!module_vtable)
                                return NULL;
-                       mono_runtime_class_init (module_vtable);
+                       exc = mono_runtime_class_init_full (module_vtable, raise_exception);
+                       if (exc)
+                               return exc;
                }
        }
        method = mono_class_get_cctor (klass);
index b3136fa0150ff7dcf01365d5b9496de8dfaf2f65..7b5c293f3ebf021f219ebcf0802414855f02d81e 100644 (file)
@@ -5016,11 +5016,16 @@ mono_jit_compile_method_with_opt (MonoMethod *method, guint32 opt, MonoException
                /* We can't use a domain specific method in another domain */
                if (! ((domain != target_domain) && !info->domain_neutral)) {
                        MonoVTable *vtable;
+                       MonoException *tmpEx;
 
                        mono_jit_stats.methods_lookups++;
                        vtable = mono_class_vtable (domain, method->klass);
                        g_assert (vtable);
-                       mono_runtime_class_init (vtable);
+                       tmpEx = mono_runtime_class_init_full (vtable, ex == NULL);
+                       if (tmpEx) {
+                               *ex = tmpEx;
+                               return NULL;
+                       }
                        return mono_create_ftnptr (target_domain, info->code_start);
                }
        }