This commit is contained in:
git 2019-07-03 04:26:53 +09:00
Родитель 796eeb6339
Коммит 9f26242411
1 изменённых файлов: 5 добавлений и 5 удалений

10
gc.c
Просмотреть файл

@ -2965,14 +2965,14 @@ should_not_capture_callback(VALUE child, void *dp)
{
struct should_not_capture_data *data = dp;
if (child == data->obj)
data->found = true;
data->found = true;
if (data->found)
return;
return;
// Maintain a set of objects already searched, so that we don't follow a cycle
if (rb_hash_lookup2(data->set, child, Qfalse))
return;
return;
rb_hash_aset(data->set, child, Qtrue);
rb_objspace_reachable_objects_from(child, should_not_capture_callback, data);
@ -2986,7 +2986,7 @@ should_not_capture(VALUE block, VALUE obj)
rb_objspace_reachable_objects_from(block, should_not_capture_callback, &data);
rb_hash_clear(data.set);
if (data.found)
rb_warn("object is reachable from finalizer - it may never be run");
rb_warn("object is reachable from finalizer - it may never be run");
}
/*
@ -3019,7 +3019,7 @@ define_final(int argc, VALUE *argv, VALUE os)
}
if (RTEST(ruby_verbose)) {
should_not_capture(block, obj);
should_not_capture(block, obj);
}
return define_final0(obj, block);