From 6643a771bff353dea57e0f20cc8e2e68407bd5f1 Mon Sep 17 00:00:00 2001 From: Dibyendu Majumdar Date: Sun, 28 Jun 2020 13:49:34 +0100 Subject: [PATCH] issue #196 missed change in non-defer mode --- src/lfunc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/lfunc.c b/src/lfunc.c index 59eed36..1715dbe 100644 --- a/src/lfunc.c +++ b/src/lfunc.c @@ -185,9 +185,10 @@ void luaF_close (lua_State *L, StkId level) { if (uv->refcount == 0) /* no references? */ luaM_free(L, uv); /* free upvalue */ else { - setobj(L, &uv->u.value, uv->v); /* move value to upvalue slot */ - uv->v = &uv->u.value; /* now current value lives here */ - luaC_upvalbarrier(L, uv); + TValue* slot = &uv->u.value; /* new position for value */ + setobj(L, slot, uv->v); /* move value to upvalue slot */ + uv->v = slot; /* now current value lives here */ + luaC_upvalbarrier(L, uv, slot); } } }