]> granicus.if.org Git - gc/commitdiff
2008-08-03 Zoltan Varga <vargaz@gmail.com>
authorZoltan Varga <vargaz@gmail.com>
Sun, 3 Aug 2008 00:18:48 +0000 (00:18 +0000)
committerguest <ivmai@mail.ru>
Fri, 29 Jul 2011 11:31:21 +0000 (15:31 +0400)
* pthread_support.c (GC_thread_exit_proc): Null out the tls key to prevent the
dtor function from being callled, since that would read freed memory.

svn path=/trunk/mono/; revision=109502

ChangeLog
pthread_support.c

index 10d43c1d3968366596cc31f53ab3ab0fa6660af0..bcf88881e977852c22f067544d475df4a87bf135 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-08-03  Zoltan Varga  <vargaz@gmail.com>
+
+       * pthread_support.c (GC_thread_exit_proc): Null out the tls key to prevent the
+       dtor function from being callled, since that would read freed memory.
+
 2008-05-23  Massimiliano Mantione  <massi@ximian.com>
        * alloc.c: Moved emitting "GC_EVENT_START" and "GC_EVENT_END" events
        from "GC_maybe_gc" to "GC_try_to_collect_inner".
index 6306f2cd0ceb244d445e0701e0d8ca2ef01bf71b..7b0c084e8bb86beaea6f058c03d3d344f5abe5b1 100644 (file)
@@ -1192,6 +1192,11 @@ void GC_thread_exit_proc(void *arg)
     me = GC_lookup_thread(pthread_self());
     GC_destroy_thread_local(me);
     if (me -> flags & DETACHED) {
+# ifdef THREAD_LOCAL_ALLOC
+               /* NULL out the tls key to prevent the dtor function from being called */
+               if (0 != GC_setspecific(GC_thread_key, NULL))
+                       ABORT("Failed to set thread specific allocation pointers");
+#endif
        GC_delete_thread(pthread_self());
     } else {
        me -> flags |= FINISHED;