From ac8d493581ea51cb489d0f111497f2181a9856d4 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Mon, 16 May 2016 19:31:56 +0200 Subject: [PATCH] [runtime] Attach the current thread in xamarin_invoke_trampoline. It's entirely possible to call xamarin_invoke_trampoline on a thread we've never heard about before. --- runtime/trampolines-invoke.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/runtime/trampolines-invoke.m b/runtime/trampolines-invoke.m index cc7b0bf39f..cc81119237 100644 --- a/runtime/trampolines-invoke.m +++ b/runtime/trampolines-invoke.m @@ -44,7 +44,7 @@ xamarin_invoke_trampoline (enum TrampolineType type, id self, SEL sel, iterator_ } } - MONO_BEGIN_GC_UNSAFE; + MONO_THREAD_ATTACH; // COOP: This will swith to GC_UNSAFE // pre-prolog SList *dispose_list = NULL; @@ -466,6 +466,6 @@ xamarin_invoke_trampoline (enum TrampolineType type, id self, SEL sel, iterator_ } xamarin_process_managed_exception (exception); - - MONO_END_GC_UNSAFE; + + MONO_THREAD_DETACH; // COOP: This will switch to GC_SAFE }