[runtime] Initialize contexts after the GC.
authorAlex Rønne Petersen <alexrp@xamarin.com>
Fri, 8 May 2015 00:52:35 +0000 (02:52 +0200)
committerAlex Rønne Petersen <alexrp@xamarin.com>
Fri, 8 May 2015 00:53:25 +0000 (02:53 +0200)
This is necessary since they use GC handles. So the handles_section must
be initialized before we try to use it.

mono/metadata/appdomain.c

index 5fa6706c1907ac9cd3961e02cc4541bf8dbf2250..01f7552faebc7b1ceaf14494f0c5b4bb89ff98a2 100644 (file)
@@ -262,8 +262,6 @@ mono_runtime_init (MonoDomain *domain, MonoThreadStartCB start_cb,
        mono_mutex_init_recursive (&mono_strtod_mutex);
        
        mono_thread_attach (domain);
-       mono_context_init (domain);
-       mono_context_set (domain->default_context);
 
        mono_type_initialization_init ();
 
@@ -273,6 +271,10 @@ mono_runtime_init (MonoDomain *domain, MonoThreadStartCB start_cb,
        /* GC init has to happen after thread init */
        mono_gc_init ();
 
+       /* contexts use GC handles, so they must be initialized after the GC */
+       mono_context_init (domain);
+       mono_context_set (domain->default_context);
+
 #ifndef DISABLE_SOCKETS
        mono_network_init ();
 #endif