From ba0f2a4383fc094c72929405691af77942b6f3db Mon Sep 17 00:00:00 2001 From: Remy Marquis Date: Thu, 28 Jan 2016 00:35:28 +0100 Subject: [PATCH] lua: backported lua 5.3.2-1 fix http://www.lua.org/bugs.html#5.3.2-1 --- lua/src/lvm.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lua/src/lvm.c b/lua/src/lvm.c index aba7ace8..e855bb99 100644 --- a/lua/src/lvm.c +++ b/lua/src/lvm.c @@ -190,18 +190,19 @@ void luaV_finishset (lua_State *L, const TValue *t, TValue *key, for (loop = 0; loop < MAXTAGLOOP; loop++) { const TValue *tm; if (oldval != NULL) { - lua_assert(ttistable(t) && ttisnil(oldval)); + Table *h = hvalue(t); /* save 't' table */ + lua_assert(ttisnil(oldval)); /* must check the metamethod */ - if ((tm = fasttm(L, hvalue(t)->metatable, TM_NEWINDEX)) == NULL && + if ((tm = fasttm(L, h->metatable, TM_NEWINDEX)) == NULL && /* no metamethod; is there a previous entry in the table? */ (oldval != luaO_nilobject || /* no previous entry; must create one. (The next test is always true; we only need the assignment.) */ - (oldval = luaH_newkey(L, hvalue(t), key), 1))) { + (oldval = luaH_newkey(L, h, key), 1))) { /* no metamethod and (now) there is an entry with given key */ setobj2t(L, cast(TValue *, oldval), val); - invalidateTMcache(hvalue(t)); - luaC_barrierback(L, hvalue(t), val); + invalidateTMcache(h); + luaC_barrierback(L, h, val); return; } /* else will try the metamethod */