diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2020-12-28 11:40:30 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2020-12-28 11:40:30 -0300 |
commit | 7af27ef59da4051914d93d8b63efac663b64765a (patch) | |
tree | 73ac919879b442904112dbb972412fc15983d50e /lapi.c | |
parent | 0ceada8da92135717d31a3954b5b89a954f9e71a (diff) | |
download | lua-7af27ef59da4051914d93d8b63efac663b64765a.tar.gz lua-7af27ef59da4051914d93d8b63efac663b64765a.tar.bz2 lua-7af27ef59da4051914d93d8b63efac663b64765a.zip |
Cleaner handling of errors in '__close' metamethods
Instead of protecting each individual metamethod call, protect the
entire call to 'luaF_close'.
Diffstat (limited to '')
-rw-r--r-- | lapi.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -188,7 +188,7 @@ LUA_API void lua_settop (lua_State *L, int idx) { | |||
188 | diff = idx + 1; /* will "subtract" index (as it is negative) */ | 188 | diff = idx + 1; /* will "subtract" index (as it is negative) */ |
189 | } | 189 | } |
190 | if (diff < 0 && hastocloseCfunc(ci->nresults)) | 190 | if (diff < 0 && hastocloseCfunc(ci->nresults)) |
191 | luaF_close(L, L->top + diff, LUA_OK); | 191 | luaF_close(L, L->top + diff, CLOSEKTOP); |
192 | L->top += diff; /* correct top only after closing any upvalue */ | 192 | L->top += diff; /* correct top only after closing any upvalue */ |
193 | lua_unlock(L); | 193 | lua_unlock(L); |
194 | } | 194 | } |