Skip to content

Commit

Permalink
Unwind callinfo (mrb->c->ci) when a fiber termitates with error.
Browse files Browse the repository at this point in the history
Fix #3668
  • Loading branch information
matz committed May 27, 2017
1 parent 57ffa1c commit 34dd258
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/vm.c
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,7 @@ mrb_vm_run(mrb_state *mrb, struct RProc *proc, mrb_value self, unsigned int stac
mrb_irep *irep = proc->body.irep;
mrb_value result;
struct mrb_context *c = mrb->c;
int cioff = c->ci - c->cibase;

if (!c->stack) {
stack_init(mrb);
Expand All @@ -859,6 +860,9 @@ mrb_vm_run(mrb_state *mrb, struct RProc *proc, mrb_value self, unsigned int stac
stack_extend(mrb, stack_keep);
c->stack[0] = self;
result = mrb_vm_exec(mrb, proc, irep->iseq);
if (c->ci - c->cibase > cioff) {
c->ci = c->cibase + cioff;
}
mrb->c = c;
return result;
}
Expand Down

0 comments on commit 34dd258

Please sign in to comment.