Merge pull request #2867 from kou/proc-fix-gc-crash

Fix a crash bug when GC is ran while creating a proc with env
This commit is contained in:
Yukihiro "Matz" Matsumoto
2015-06-29 18:33:46 +09:00
+1
View File
@@ -93,6 +93,7 @@ mrb_proc_new_cfunc_with_env(mrb_state *mrb, mrb_func_t func, mrb_int argc, const
int i;
p->env = e = env_new(mrb, argc);
mrb_field_write_barrier(mrb, (struct RBasic *)p, (struct RBasic *)p->env);
MRB_ENV_UNSHARE_STACK(e);
e->stack = (mrb_value*)mrb_malloc(mrb, sizeof(mrb_value) * argc);
if (argv) {