Merge pull request #6328 from dearblue/env-obj_free

This commit is contained in:
Yukihiro "Matz" Matsumoto
2024-08-28 16:40:04 +09:00
committed by GitHub
+1 -1
View File
@@ -800,7 +800,7 @@ obj_free(mrb_state *mrb, struct RBasic *obj, mrb_bool end)
while (ce <= ci) {
struct REnv *e = ci->u.env;
if (e && !is_dead(&mrb->gc, (struct RBasic*)e) &&
if (e && heap_p(&mrb->gc, (struct RBasic*)e) && !is_dead(&mrb->gc, (struct RBasic*)e) &&
e->tt == MRB_TT_ENV && MRB_ENV_ONSTACK_P(e)) {
mrb_env_unshare(mrb, e, TRUE);
}