Init the unwind state struct so callers can rely on its content on failure.
authorRodrigo Kumpera <kumpera@gmail.com>
Tue, 24 Jan 2012 18:12:09 +0000 (16:12 -0200)
committerRodrigo Kumpera <kumpera@gmail.com>
Tue, 24 Jan 2012 18:12:29 +0000 (16:12 -0200)
mono/mini/mini-darwin.c

index ee5f8381b72ad50de4a6aa28f756b0c2cb591f33..96fdb5e7cae0a69d7e382c28e4fafe950450df55 100644 (file)
@@ -274,6 +274,12 @@ mono_thread_state_init_from_handle (MonoThreadUnwindState *tctx, MonoNativeThrea
        guint32 lmf_key;
 #endif
 
+       /*Zero enough state to make sure the caller doesn't confuse itself*/
+       tctx->valid = FALSE;
+       tctx->unwind_data [MONO_UNWIND_DATA_DOMAIN] = NULL;
+       tctx->unwind_data [MONO_UNWIND_DATA_LMF] = NULL;
+       tctx->unwind_data [MONO_UNWIND_DATA_JIT_TLS] = NULL;
+
        state = (thread_state_t) alloca (mono_mach_arch_get_thread_state_size ());
        mctx = (mcontext_t) alloca (mono_mach_arch_get_mcontext_size ());