should have protected the return value from GC, even when the method is...

should have protected the return value from GC, even when the method is defined in Ruby; close #1263
parent 2045a352
...@@ -384,7 +384,6 @@ mrb_funcall_with_block(mrb_state *mrb, mrb_value self, mrb_sym mid, int argc, mr ...@@ -384,7 +384,6 @@ mrb_funcall_with_block(mrb_state *mrb, mrb_value self, mrb_sym mid, int argc, mr
int ai = mrb_gc_arena_save(mrb); int ai = mrb_gc_arena_save(mrb);
val = p->body.func(mrb, self); val = p->body.func(mrb, self);
mrb_gc_arena_restore(mrb, ai); mrb_gc_arena_restore(mrb, ai);
mrb_gc_protect(mrb, val);
mrb->c->stack = mrb->c->stbase + mrb->c->ci->stackidx; mrb->c->stack = mrb->c->stbase + mrb->c->ci->stackidx;
cipop(mrb); cipop(mrb);
} }
...@@ -392,6 +391,7 @@ mrb_funcall_with_block(mrb_state *mrb, mrb_value self, mrb_sym mid, int argc, mr ...@@ -392,6 +391,7 @@ mrb_funcall_with_block(mrb_state *mrb, mrb_value self, mrb_sym mid, int argc, mr
val = mrb_run(mrb, p, self); val = mrb_run(mrb, p, self);
} }
} }
mrb_gc_protect(mrb, val);
return val; return val;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment