[runtime] Call unhandled exception handler explicitly to fix for bitcode
authorAlexander Kyte <alkyte@microsoft.com>
Sat, 23 Jul 2016 06:41:11 +0000 (02:41 -0400)
committerAlexander Kyte <alkyte@microsoft.com>
Mon, 25 Jul 2016 16:12:34 +0000 (12:12 -0400)
mono/metadata/threads.c

index 50a4329603c88dd60e2ad06a1e78e1a2334ad7f4..6442d702a493c7775491a3c949488b47464f737c 100644 (file)
@@ -745,7 +745,14 @@ static guint32 WINAPI start_wrapper_internal(void *data)
                args [0] = start_arg;
                /* we may want to handle the exception here. See comment below on unhandled exceptions */
                mono_runtime_delegate_invoke_checked (start_delegate, args, &error);
-               mono_error_raise_exception (&error); /* OK, triggers unhandled exn handler */
+
+               if (!mono_error_ok (&error)) {
+                       MonoException *ex = mono_error_convert_to_exception (&error);
+                       if (ex)
+                               mono_unhandled_exception (&ex->object);
+               } else {
+                       mono_error_cleanup (&error);
+               }
        }
 
        /* If the thread calls ExitThread at all, this remaining code