From cb55043383cbf39ac1df1d227836080a3d7cef33 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Thu, 16 Oct 2025 17:11:30 -0400 Subject: Set method table owned by iclass in rb_class_duplicate_classext We duplicate the method table in rb_class_duplicate_classext, so we should set RCLASSEXT_ICLASS_IS_ORIGIN and unset RCLASSEXT_ICLASS_ORIGIN_SHARED_MTBL to signal that the iclass owns the method table and it should be freed. --- class.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'class.c') diff --git a/class.c b/class.c index 469cc5e54f..c8bf624140 100644 --- a/class.c +++ b/class.c @@ -305,6 +305,8 @@ rb_class_duplicate_classext(rb_classext_t *orig, VALUE klass, const rb_namespace RCLASSEXT_SUPER(ext) = RCLASSEXT_SUPER(orig); RCLASSEXT_M_TBL(ext) = duplicate_classext_m_tbl(RCLASSEXT_M_TBL(orig), klass, dup_iclass); + RCLASSEXT_ICLASS_IS_ORIGIN(ext) = true; + RCLASSEXT_ICLASS_ORIGIN_SHARED_MTBL(ext) = false; if (orig->fields_obj) { RB_OBJ_WRITE(klass, &ext->fields_obj, rb_imemo_fields_clone(orig->fields_obj)); -- cgit v1.2.3