Avoid unsharing env when context (mrb->c) differs; ref #3668

parent 54b45f6a
......@@ -264,6 +264,7 @@ mrb_env_unshare(mrb_state *mrb, struct REnv *e)
mrb_value *p;
if (!MRB_ENV_STACK_SHARED_P(e)) return;
if (e->cxt.c != mrb->c) return;
if (e->cioff == 0 && e->cxt.c == mrb->root_c) return;
MRB_ENV_UNSHARE_STACK(e);
if (!e->c) {
......
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