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)
849
849
attached = mono_tls_get_jit_tls () != NULL ;
850
850
851
851
if (!attached ) {
852
- mono_thread_attach (domain );
852
+ mono_thread_attach (mono_get_root_domain () );
853
853
854
854
// #678164
855
855
mono_thread_set_state (mono_thread_internal_current (), ThreadState_Background );
856
856
}
857
857
858
858
orig = mono_domain_get ();
859
- if (orig != domain )
859
+ if (orig != domain ) {
860
+ mono_thread_push_appdomain_ref (domain );
860
861
mono_domain_set (domain , TRUE);
862
+ }
861
863
862
864
return orig != domain ? orig : NULL ;
863
865
}
@@ -872,8 +874,10 @@ mono_jit_set_domain (MonoDomain *domain)
872
874
{
873
875
g_assert (!mono_threads_is_blocking_transition_enabled ());
874
876
875
- if (domain )
877
+ if (domain ) {
876
878
mono_domain_set (domain , TRUE);
879
+ mono_thread_pop_appdomain_ref ();
880
+ }
877
881
}
878
882
879
883
/**
You can’t perform that action at this time.
0 commit comments