Skip to content

Commit

Permalink
Need to insert write barriers in struct updates; fix #3547
Browse files Browse the repository at this point in the history
  • Loading branch information
matz committed Apr 5, 2017
1 parent bdeb803 commit 74712c7
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions mrbgems/mruby-struct/src/struct.c
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,7 @@ mrb_struct_aset_sym(mrb_state *mrb, mrb_value s, mrb_sym id, mrb_value val)
for (i=0; i<len; i++) {
if (mrb_symbol(ptr_members[i]) == id) {
ptr[i] = val;
mrb_write_barrier(mrb, (struct RBasic*)mrb_ptr(s));
return val;
}
}
Expand Down Expand Up @@ -511,6 +512,7 @@ mrb_struct_aset(mrb_state *mrb, mrb_value s)
"offset %S too large for struct(size:%S)",
mrb_fixnum_value(i), mrb_fixnum_value(RSTRUCT_LEN(s)));
}
mrb_write_barrier(mrb, (struct RBasic*)mrb_ptr(s));
return RSTRUCT_PTR(s)[i] = val;
}

Expand Down

0 comments on commit 74712c7

Please sign in to comment.