Skip to content

Commit 74712c7

Browse files
committed
Need to insert write barriers in struct updates; fix #3547
1 parent bdeb803 commit 74712c7

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

mrbgems/mruby-struct/src/struct.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,7 @@ mrb_struct_aset_sym(mrb_state *mrb, mrb_value s, mrb_sym id, mrb_value val)
449449
for (i=0; i<len; i++) {
450450
if (mrb_symbol(ptr_members[i]) == id) {
451451
ptr[i] = val;
452+
mrb_write_barrier(mrb, (struct RBasic*)mrb_ptr(s));
452453
return val;
453454
}
454455
}
@@ -511,6 +512,7 @@ mrb_struct_aset(mrb_state *mrb, mrb_value s)
511512
"offset %S too large for struct(size:%S)",
512513
mrb_fixnum_value(i), mrb_fixnum_value(RSTRUCT_LEN(s)));
513514
}
515+
mrb_write_barrier(mrb, (struct RBasic*)mrb_ptr(s));
514516
return RSTRUCT_PTR(s)[i] = val;
515517
}
516518

0 commit comments

Comments
 (0)