File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -849,15 +849,17 @@ mono_jit_thread_attach (MonoDomain *domain)
849849 attached = mono_tls_get_jit_tls () != NULL ;
850850
851851 if (!attached ) {
852- mono_thread_attach (domain );
852+ mono_thread_attach (mono_get_root_domain () );
853853
854854 // #678164
855855 mono_thread_set_state (mono_thread_internal_current (), ThreadState_Background );
856856 }
857857
858858 orig = mono_domain_get ();
859- if (orig != domain )
859+ if (orig != domain ) {
860+ mono_thread_push_appdomain_ref (domain );
860861 mono_domain_set (domain , TRUE);
862+ }
861863
862864 return orig != domain ? orig : NULL ;
863865}
@@ -872,8 +874,10 @@ mono_jit_set_domain (MonoDomain *domain)
872874{
873875 g_assert (!mono_threads_is_blocking_transition_enabled ());
874876
875- if (domain )
877+ if (domain ) {
876878 mono_domain_set (domain , TRUE);
879+ mono_thread_pop_appdomain_ref ();
880+ }
877881}
878882
879883/**
You can’t perform that action at this time.
0 commit comments