rb_gc_impl_copy_finalizer: generate a new object id

Fix a regression introduced by: https://github.com/ruby/ruby/pull/13155
This commit is contained in:
Jean Boussier 2025-05-15 14:04:36 +02:00
parent a294427017
commit ec8900e3eb
Notes: git 2025-05-16 18:17:06 +00:00
4 changed files with 25 additions and 4 deletions

View file

@ -2805,7 +2805,8 @@ rb_gc_impl_copy_finalizer(void *objspace_ptr, VALUE dest, VALUE obj)
int lev = rb_gc_vm_lock();
if (RB_LIKELY(st_lookup(finalizer_table, obj, &data))) {
table = (VALUE)data;
table = rb_ary_dup((VALUE)data);
RARRAY_ASET(table, 0, rb_obj_id(dest));
st_insert(finalizer_table, dest, table);
FL_SET(dest, FL_FINALIZE);
}

View file

@ -985,7 +985,8 @@ rb_gc_impl_copy_finalizer(void *objspace_ptr, VALUE dest, VALUE obj)
int lev = rb_gc_vm_lock();
if (RB_LIKELY(st_lookup(objspace->finalizer_table, obj, &data))) {
table = (VALUE)data;
table = rb_ary_dup((VALUE)data);
RARRAY_ASET(table, 0, rb_obj_id(dest));
st_insert(objspace->finalizer_table, dest, table);
FL_SET(dest, FL_FINALIZE);
}