Clear `irep->outer` when no `Proc` reference the `irep`; fix #3793

parent fd927d78
...@@ -815,7 +815,11 @@ obj_free(mrb_state *mrb, struct RBasic *obj, int end) ...@@ -815,7 +815,11 @@ obj_free(mrb_state *mrb, struct RBasic *obj, int end)
struct RProc *p = (struct RProc*)obj; struct RProc *p = (struct RProc*)obj;
if (!MRB_PROC_CFUNC_P(p) && p->body.irep) { if (!MRB_PROC_CFUNC_P(p) && p->body.irep) {
int refcnt = p->body.irep->refcnt;
mrb_irep_decref(mrb, p->body.irep); mrb_irep_decref(mrb, p->body.irep);
if (refcnt == 2) { /* reference only from irep */
p->body.irep->outer = NULL;
}
} }
} }
break; break;
......
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