diff --git a/gc.c b/gc.c index de34844503a3bf..3b18bcf3dbbf4e 100644 --- a/gc.c +++ b/gc.c @@ -4372,7 +4372,7 @@ rb_objspace_call_finalizer_i(VALUE obj, void *data) switch (BUILTIN_TYPE(obj)) { case T_DATA: - if (!rb_free_at_exit && (!DATA_PTR(obj) || !RDATA(obj)->dfree)) break; + if (!rb_free_at_exit && (!RTYPEDDATA_GET_DATA(obj) || !RANY(obj)->as.typeddata.type->function.dfree)) break; if (rb_obj_is_thread(obj)) break; if (rb_obj_is_mutex(obj)) break; if (rb_obj_is_fiber(obj)) break;