Skip to content

Commit

Permalink
fix initialize order
Browse files Browse the repository at this point in the history
`captured->code.val` should be initialize before because it can be
a GC point by another ractor because `RB_OBJ_WRITE` can issue
VM locking.
  • Loading branch information
ko1 committed Dec 4, 2020
1 parent 82bbce8 commit e8cee49
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion vm.c
Expand Up @@ -905,8 +905,8 @@ vm_proc_create_from_captured(VALUE klass,
VM_ASSERT(VM_EP_IN_HEAP_P(GET_EC(), captured->ep));

/* copy block */
RB_OBJ_WRITE(procval, &proc->block.as.captured.self, captured->self);
RB_OBJ_WRITE(procval, &proc->block.as.captured.code.val, captured->code.val);
RB_OBJ_WRITE(procval, &proc->block.as.captured.self, captured->self);
rb_vm_block_ep_update(procval, &proc->block, captured->ep);

vm_block_type_set(&proc->block, block_type);
Expand Down

0 comments on commit e8cee49

Please sign in to comment.