Fri Dec 11 18:24:04 CET 2009 Paolo Molaro <lupus@ximian.com>
authorPaolo Molaro <lupus@oddwiz.org>
Fri, 11 Dec 2009 17:15:57 +0000 (17:15 -0000)
committerPaolo Molaro <lupus@oddwiz.org>
Fri, 11 Dec 2009 17:15:57 +0000 (17:15 -0000)
* boehm-gc.c: fixed race condition while getting the target of a
disappearing link (bug #522233).

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

mono/metadata/ChangeLog
mono/metadata/boehm-gc.c

index 06e83e7d13186a5a22537f86fb55647919cd797a..eb8e35b8de1f9dd799fc85fd994dea0222cb2649 100644 (file)
@@ -1,3 +1,9 @@
+
+Fri Dec 11 18:24:04 CET 2009 Paolo Molaro <lupus@ximian.com>
+
+       * boehm-gc.c: fixed race condition while getting the target of a
+       disappearing link (bug #522233).
+
 2009-12-10  Rodrigo Kumpera  <rkumpera@novell.com>
 
        * class.c (mono_type_get_full): Produce warning instead of simply swallowing
index 96d54488d0e80ccd91065fa5e09e2c80c92fb1b6..990760559864a857e8d6e2dbf060b4a2c19ee439 100644 (file)
@@ -324,10 +324,17 @@ mono_gc_weak_link_remove (void **link_addr)
        *link_addr = NULL;
 }
 
+static gpointer
+reveal_link (gpointer link_addr)
+{
+       void **link_a = link_addr;
+       return REVEAL_POINTER (*link_a);
+}
+
 MonoObject*
 mono_gc_weak_link_get (void **link_addr)
 {
-       MonoObject *obj = REVEAL_POINTER (*link_addr);
+       MonoObject *obj = GC_call_with_alloc_lock (reveal_link, link_addr);
        if (obj == (MonoObject *) -1)
                return NULL;
        return obj;