Merge pull request #6385 from dearblue/gc-register.1

This commit is contained in:
Yukihiro "Matz" Matsumoto
2024-10-21 10:49:37 +09:00
committed by GitHub
+1 -1
View File
@@ -431,7 +431,7 @@ mrb_gc_register(mrb_state *mrb, mrb_value obj)
table = mrb_gv_get(mrb, GC_ROOT_SYM);
int ai = mrb_gc_arena_save(mrb);
mrb_gc_protect(mrb, obj);
if (mrb_nil_p(table) || !mrb_array_p(table)) {
if (!mrb_array_p(table)) {
table = mrb_ary_new(mrb);
mrb_obj_ptr(table)->c = NULL; /* hide from ObjectSpace.each_object */
mrb_gv_set(mrb, GC_ROOT_SYM, table);