Make weak links initialized to NULL before calling mono_gc_weak_link_add().
authorMark Probst <mark.probst@gmail.com>
Tue, 27 Nov 2012 17:07:48 +0000 (18:07 +0100)
committerMark Probst <mark.probst@gmail.com>
Sun, 9 Dec 2012 14:02:52 +0000 (15:02 +0100)
This has no effect, but the weak link DTrace probes don't get uninitialized
pointers anymore.

mono/metadata/gc.c
mono/metadata/monitor.c

index 0c2f7549552f680bd14169c507db704905bba65c..1bee3e969c675047300360b707b994f83f4f753f 100644 (file)
@@ -731,12 +731,14 @@ alloc_handle (HandleData *handles, MonoObject *obj, gboolean track)
        }
        handles->bitmap [slot] |= 1 << i;
        slot = slot * 32 + i;
-       handles->entries [slot] = obj;
+       handles->entries [slot] = NULL;
        if (handles->type <= HANDLE_WEAK_TRACK) {
                /*FIXME, what to use when obj == null?*/
                handles->domain_ids [slot] = (obj ? mono_object_get_domain (obj) : mono_domain_get ())->domain_id;
                if (obj)
                        mono_gc_weak_link_add (&(handles->entries [slot]), obj, track);
+       } else {
+               handles->entries [slot] = obj;
        }
 
 #ifndef DISABLE_PERFCOUNTERS
index 2d1f0545623a772254ed06526fe9714b6dad4adf..e612f2052775b06a30a51ea7d9106de1f9a2d3ee 100644 (file)
@@ -311,6 +311,7 @@ mon_new (gsize id)
 
        new->owner = id;
        new->nest = 1;
+       new->data = NULL;
        
 #ifndef DISABLE_PERFCOUNTERS
        mono_perfcounters->gc_sync_blocks++;