|
that IS subtleOn Fri, Jan 1, 2016 at 6:30 AM, Roberto Ierusalimschy
<roberto@inf.puc-rio.br> wrote:
> The bug is quite subtle. Follows a fix:
>
> diff for lvm.c:
> ----------------------------------------
> 193c193,194
> < lua_assert(ttistable(t) && ttisnil(oldval));
> ---
> > Table *h = hvalue(t);
> > lua_assert(ttisnil(oldval));
> 195c196
> < if ((tm = fasttm(L, hvalue(t)->metatable, TM_NEWINDEX)) == NULL &&
> ---
> > if ((tm = fasttm(L, h->metatable, TM_NEWINDEX)) == NULL &&
> 200c201
> < (oldval = luaH_newkey(L, hvalue(t), key), 1))) {
> ---
> > (oldval = luaH_newkey(L, h, key), 1))) {
> 203,204c204,205
> < invalidateTMcache(hvalue(t));
> < luaC_barrierback(L, hvalue(t), val);
> ---
> > invalidateTMcache(h);
> > luaC_barrierback(L, h, val);