From bf27e2544662ab34e1d50f1d43ea96ee2502c685 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Fri, 23 Mar 2018 16:00:39 -0400 Subject: Remove suspicious mono_gchandle_free Fixes https://github.com/mono/mono/issues/7786 --- mono/metadata/threads.c | 3 +-- mono/utils/mono-threads.c | 3 +++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/mono/metadata/threads.c b/mono/metadata/threads.c index 5bca4f0ab73..e5ab853cd3c 100644 --- a/mono/metadata/threads.c +++ b/mono/metadata/threads.c @@ -3008,6 +3008,7 @@ thread_detach (MonoThreadInfo *info) * the thread */ g_assert (info); + g_assert (mono_thread_info_is_current (info)); if (!mono_thread_info_try_get_internal_thread_gchandle (info, &gchandle)) return; @@ -3015,8 +3016,6 @@ thread_detach (MonoThreadInfo *info) internal = (MonoInternalThread*) mono_gchandle_get_target (gchandle); g_assert (internal); - mono_gchandle_free (gchandle); - mono_thread_detach_internal (internal); } diff --git a/mono/utils/mono-threads.c b/mono/utils/mono-threads.c index d41724d7a6f..4e77d0d5582 100644 --- a/mono/utils/mono-threads.c +++ b/mono/utils/mono-threads.c @@ -685,6 +685,7 @@ gboolean mono_thread_info_try_get_internal_thread_gchandle (MonoThreadInfo *info, guint32 *gchandle) { g_assert (info); + g_assert (mono_thread_info_is_current (info)); if (info->internal_thread_gchandle == G_MAXUINT32) return FALSE; @@ -697,6 +698,7 @@ void mono_thread_info_set_internal_thread_gchandle (MonoThreadInfo *info, guint32 gchandle) { g_assert (info); + g_assert (mono_thread_info_is_current (info)); g_assert (gchandle != G_MAXUINT32); info->internal_thread_gchandle = gchandle; } @@ -705,6 +707,7 @@ void mono_thread_info_unset_internal_thread_gchandle (THREAD_INFO_TYPE *info) { g_assert (info); + g_assert (mono_thread_info_is_current (info)); info->internal_thread_gchandle = G_MAXUINT32; } -- cgit v1.2.3