Skip to content

Commit 35d0748

Browse files
committed
cleanup the threadinfo before shutdown to fix crash in pthread_key_clean_all
1 parent 7e7a83f commit 35d0748

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

mono/metadata/domain.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -853,6 +853,8 @@ mono_cleanup (void)
853853
{
854854
mono_close_exe_image ();
855855

856+
mono_thread_info_cleanup ();
857+
856858
mono_defaults.corlib = NULL;
857859

858860
mono_config_cleanup ();

mono/utils/mono-threads.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,13 @@ thread_info_key_dtor (void *arg)
738738
}
739739
#endif
740740

741+
void
742+
mono_thread_info_cleanup ()
743+
{
744+
mono_native_tls_free (thread_info_key);
745+
mono_native_tls_free (thread_exited_key);
746+
}
747+
741748
void
742749
mono_thread_info_init (size_t info_size)
743750
{

mono/utils/mono-threads.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,9 @@ mono_thread_info_set_tid (THREAD_INFO_TYPE *info, MonoNativeThreadId tid)
310310
((MonoThreadInfo*) info)->node.key = (uintptr_t) MONO_NATIVE_THREAD_ID_TO_UINT (tid);
311311
}
312312

313+
void
314+
mono_thread_info_cleanup (void);
315+
313316
/*
314317
* @thread_info_size is sizeof (GcThreadInfo), a struct the GC defines to make it possible to have
315318
* a single block with info from both camps.

0 commit comments

Comments
 (0)