Merge pull request #2454 from tastywheattasteslikechicken/FixVtableAbort
authorZoltan Varga <vargaz@gmail.com>
Wed, 16 Mar 2016 09:54:02 +0000 (10:54 +0100)
committerZoltan Varga <vargaz@gmail.com>
Wed, 16 Mar 2016 09:54:02 +0000 (10:54 +0100)
[runtime] Fixes an abort caused by a TypeLoadException in certain ins…

1  2 
mono/mini/mini-runtime.c

index 6a9f054864b68efb5c4915a9b234c442443ec58e,bb4181859b6caacbb062a1a9ba4a171d40df0d04..136239a1211c7c217c32221e20bcd5faccc72aa4
@@@ -2005,12 -1890,22 +2005,18 @@@ mono_jit_compile_method_with_opt (MonoM
                /* 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);
+                       vtable = mono_class_vtable_full (domain, method->klass, ex == NULL);
+                       if (ex && method->klass->exception_type) {
+                               *ex = mono_class_get_exception_for_failure (method->klass);
+                               return NULL;
+                       }
                        g_assert (vtable);
 -                      tmpEx = mono_runtime_class_init_full (vtable, ex == NULL);
 -                      if (tmpEx) {
 -                              *ex = tmpEx;
 +                      if (!mono_runtime_class_init_full (vtable, error))
                                return NULL;
 -                      }
                        return mono_create_ftnptr (target_domain, info->code_start);
                }
        }