mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
env referred from top-level callinfo should not be unshared; fix #4019
Because `mirb` keeps top-level environment across each iteration.
This commit is contained in:
@@ -300,6 +300,7 @@ mrb_env_unshare(mrb_state *mrb, struct REnv *e)
|
||||
|
||||
if (!MRB_ENV_STACK_SHARED_P(e)) return;
|
||||
if (e->cxt != mrb->c) return;
|
||||
if (e == mrb->c->cibase->env) return; /* for mirb */
|
||||
p = (mrb_value *)mrb_malloc(mrb, sizeof(mrb_value)*len);
|
||||
if (len > 0) {
|
||||
stack_copy(p, e->stack, len);
|
||||
|
||||
Reference in New Issue
Block a user