diff options
Diffstat (limited to 'lfunc.c')
-rw-r--r-- | lfunc.c | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -202,13 +202,12 @@ void luaF_unlinkupval (UpVal *uv) { | |||
202 | int luaF_close (lua_State *L, StkId level, int status) { | 202 | int luaF_close (lua_State *L, StkId level, int status) { |
203 | UpVal *uv; | 203 | UpVal *uv; |
204 | while ((uv = L->openupval) != NULL && uplevel(uv) >= level) { | 204 | while ((uv = L->openupval) != NULL && uplevel(uv) >= level) { |
205 | StkId upl = uplevel(uv); | ||
206 | TValue *slot = &uv->u.value; /* new position for value */ | 205 | TValue *slot = &uv->u.value; /* new position for value */ |
207 | lua_assert(upl < L->top); | 206 | lua_assert(uplevel(uv) < L->top); |
208 | if (uv->tt == LUA_TUPVALTBC && status != NOCLOSINGMETH) { | 207 | if (uv->tt == LUA_TUPVALTBC && status != NOCLOSINGMETH) { |
209 | /* must run closing method */ | 208 | /* must run closing method, which may change the stack */ |
210 | ptrdiff_t levelrel = savestack(L, level); | 209 | ptrdiff_t levelrel = savestack(L, level); |
211 | status = callclosemth(L, upl, status); /* may change the stack */ | 210 | status = callclosemth(L, uplevel(uv), status); |
212 | level = restorestack(L, levelrel); | 211 | level = restorestack(L, levelrel); |
213 | } | 212 | } |
214 | luaF_unlinkupval(uv); | 213 | luaF_unlinkupval(uv); |