slot = slot * 32 + i;
handles->entries [slot] = obj;
if (handles->type <= HANDLE_WEAK_TRACK) {
- mono_gc_weak_link_add (&(handles->entries [slot]), obj);
+ if (obj)
+ mono_gc_weak_link_add (&(handles->entries [slot]), obj);
}
unlock_handles (handles);
if (slot < handles->size && (handles->bitmap [slot / 32] & (1 << (slot % 32)))) {
if (handles->type <= HANDLE_WEAK_TRACK) {
mono_gc_weak_link_remove (&handles->entries [slot]);
- mono_gc_weak_link_add (&handles->entries [slot], obj);
+ if (obj)
+ mono_gc_weak_link_add (&handles->entries [slot], obj);
} else {
handles->entries [slot] = obj;
}
finalize_notify ();
/* Finishing the finalizer thread, so wait a little bit... */
/* MS seems to wait for about 2 seconds */
- if (WaitForSingleObjectEx (shutdown_event, 2000000, FALSE) == WAIT_TIMEOUT) {
+ if (WaitForSingleObjectEx (shutdown_event, 2000, FALSE) == WAIT_TIMEOUT) {
mono_thread_stop (gc_thread);
}
}