[jit] Use mono_error_set_pending_exception () in jit icalls.
authorZoltan Varga <vargaz@gmail.com>
Wed, 1 Apr 2015 01:26:35 +0000 (21:26 -0400)
committerZoltan Varga <vargaz@gmail.com>
Wed, 1 Apr 2015 01:26:35 +0000 (21:26 -0400)
mono/mini/jit-icalls.c

index 3328d51bf2d66324c74263aa00dc9607101d910f..e69381bcffcbb5c24ae9c795247939eba47bb66e 100644 (file)
@@ -51,7 +51,10 @@ ldvirtfn_internal (MonoObject *obj, MonoMethod *method, gboolean gshared)
                context.method_inst = mono_method_get_context (method)->method_inst;
 
                res = mono_class_inflate_generic_method_checked (res, &context, &error);
-               mono_error_raise_exception (&error);
+               if (!mono_error_ok (&error)) {
+                       mono_error_set_pending_exception (&error);
+                       return NULL;
+               }
        }
 
        /* An rgctx wrapper is added by the trampolines no need to do it here */
@@ -815,7 +818,10 @@ mono_ldtoken_wrapper (MonoImage *image, int token, MonoGenericContext *context)
        gpointer res;
 
        res = mono_ldtoken_checked (image, token, &handle_class, context, &error);
-       mono_error_raise_exception (&error);
+       if (!mono_error_ok (&error)) {
+               mono_error_set_pending_exception (&error);
+               return NULL;
+       }
        mono_class_init (handle_class);
 
        return res;
@@ -1044,7 +1050,11 @@ mono_helper_newobj_mscorlib (guint32 idx)
 {
        MonoError error;
        MonoClass *klass = mono_class_get_checked (mono_defaults.corlib, MONO_TOKEN_TYPE_DEF | idx, &error);
-       mono_error_raise_exception (&error);
+
+       if (!mono_error_ok (&error)) {
+               mono_error_set_pending_exception (&error);
+               return NULL;
+       }
 
        return mono_object_new (mono_domain_get (), klass);
 }