summaryrefslogtreecommitdiff
path: root/class.c
diff options
context:
space:
mode:
authorPeter Zhu <peter@peterzhu.ca>2025-10-16 17:11:30 -0400
committerPeter Zhu <peter@peterzhu.ca>2025-10-17 17:26:00 -0400
commitcb55043383cbf39ac1df1d227836080a3d7cef33 (patch)
treeeca8a349b469a13e534a782fa067522f2d197fe2 /class.c
parent1c119f02456ff7dd3a4025456f8de5e50be88ef3 (diff)
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.
Diffstat (limited to 'class.c')
-rw-r--r--class.c2
1 files changed, 2 insertions, 0 deletions
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));