Don't assert in mono_get_lmf() if there is no LMF.
authorMark Probst <mark.probst@gmail.com>
Wed, 5 Jan 2011 14:39:46 +0000 (15:39 +0100)
committerMark Probst <mark.probst@gmail.com>
Wed, 5 Jan 2011 14:40:38 +0000 (15:40 +0100)
This function is called from mini-gc.c when a collection is triggered,
which can happen before any managed call is executed by the thread.
At least the allocation of the thread object happens in unmanaged code.

mono/mini/mini.c

index 19aa735e0acaa8a361d33caf302bf90ba535a827..e8cade800a21ce8645816b46a459006e54c0c6fa 100644 (file)
@@ -2419,8 +2419,11 @@ mono_get_lmf (void)
 
        if ((jit_tls = TlsGetValue (mono_jit_tls_id)))
                return jit_tls->lmf;
-
-       g_assert_not_reached ();
+       /*
+        * We do not assert here because this function can be called from
+        * mini-gc.c on a thread that has not executed any managed code, yet
+        * (the thread object allocation can trigger a collection).
+        */
        return NULL;
 #endif
 }