Skip to content

Commit cb55043

Browse files
committed
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.
1 parent 1c119f0 commit cb55043

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

class.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,8 @@ rb_class_duplicate_classext(rb_classext_t *orig, VALUE klass, const rb_namespace
305305
RCLASSEXT_SUPER(ext) = RCLASSEXT_SUPER(orig);
306306

307307
RCLASSEXT_M_TBL(ext) = duplicate_classext_m_tbl(RCLASSEXT_M_TBL(orig), klass, dup_iclass);
308+
RCLASSEXT_ICLASS_IS_ORIGIN(ext) = true;
309+
RCLASSEXT_ICLASS_ORIGIN_SHARED_MTBL(ext) = false;
308310

309311
if (orig->fields_obj) {
310312
RB_OBJ_WRITE(klass, &ext->fields_obj, rb_imemo_fields_clone(orig->fields_obj));

0 commit comments

Comments
 (0)