diff options
-rw-r--r-- | mono/mini/debugger-agent.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/mono/mini/debugger-agent.c b/mono/mini/debugger-agent.c index 7714b37be70..d6bd7421fad 100644 --- a/mono/mini/debugger-agent.c +++ b/mono/mini/debugger-agent.c @@ -3977,13 +3977,17 @@ thread_end (MonoProfiler *prof, uintptr_t tid) /* We might be called for threads started before we registered the start callback */ if (thread) { - DEBUG_PRINTF (1, "[%p] Thread terminated, obj=%p, tls=%p.\n", (gpointer)tid, thread, tls); + DEBUG_PRINTF (1, "[%p] Thread terminated, obj=%p, tls=%p (domain=%p).\n", (gpointer)tid, thread, tls, (gpointer)mono_domain_get ()); - if (mono_thread_internal_is_current (thread) && !mono_native_tls_get_value (debugger_tls_id) + if (mono_thread_internal_is_current (thread) && + (!mono_native_tls_get_value (debugger_tls_id) || + !mono_domain_get ()) ) { /* - * This can happen on darwin since we deregister threads using pthread dtors. - * process_profiler_event () and the code it calls cannot handle a null TLS value. + * This can happen on darwin and android since we + * deregister threads using pthread dtors. + * process_profiler_event () and the code it calls + * cannot handle a null TLS value. */ return; } |