Move frozen check out of rb_gc_impl_undefine_finalizer

This commit is contained in:
Peter Zhu 2024-07-18 13:40:42 -04:00
parent 4b05d2dbb0
commit 51505f70e3
Notes: git 2024-07-19 12:53:50 +00:00
2 changed files with 5 additions and 1 deletions

2
gc.c
View File

@ -1448,6 +1448,8 @@ os_each_obj(int argc, VALUE *argv, VALUE os)
static VALUE
undefine_final(VALUE os, VALUE obj)
{
rb_check_frozen(obj);
rb_gc_impl_undefine_finalizer(rb_gc_get_objspace(), obj);
return obj;

View File

@ -3005,8 +3005,10 @@ void
rb_gc_impl_undefine_finalizer(void *objspace_ptr, VALUE obj)
{
rb_objspace_t *objspace = objspace_ptr;
GC_ASSERT(!OBJ_FROZEN(obj));
st_data_t data = obj;
rb_check_frozen(obj);
st_delete(finalizer_table, &data, 0);
FL_UNSET(obj, FL_FINALIZE);
}