Add write barrier to protect singleton class from GC; fix
@@ -318,6 +318,7 @@ mrb_obj_clone(mrb_state *mrb, mrb_value self)
}
p = (struct RObject*)mrb_obj_alloc(mrb, mrb_type(self), mrb_obj_class(mrb, self));
p->c = mrb_singleton_class_clone(mrb, self);
+ mrb_field_write_barrier(mrb, (struct RBasic*)p, (struct RBasic*)p->c);
clone = mrb_obj_value(p);
init_copy(mrb, clone, self);
