bug: `lua_setfenv' needs a write barrier
This commit is contained in:
9
lapi.c
9
lapi.c
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: lapi.c,v 2.12 2004/06/08 14:31:00 roberto Exp roberto $
|
** $Id: lapi.c,v 2.13 2004/06/30 14:15:23 roberto Exp roberto $
|
||||||
** Lua API
|
** Lua API
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@@ -677,12 +677,13 @@ LUA_API int lua_setfenv (lua_State *L, int idx) {
|
|||||||
api_checknelems(L, 1);
|
api_checknelems(L, 1);
|
||||||
o = luaA_index(L, idx);
|
o = luaA_index(L, idx);
|
||||||
api_checkvalidindex(L, o);
|
api_checkvalidindex(L, o);
|
||||||
L->top--;
|
api_check(L, ttistable(L->top - 1));
|
||||||
api_check(L, ttistable(L->top));
|
|
||||||
if (isLfunction(o)) {
|
if (isLfunction(o)) {
|
||||||
res = 1;
|
res = 1;
|
||||||
clvalue(o)->l.g = *(L->top);
|
clvalue(o)->l.g = *(L->top - 1);
|
||||||
|
luaC_objbarrier(L, clvalue(o), hvalue(L->top - 1));
|
||||||
}
|
}
|
||||||
|
L->top--;
|
||||||
lua_unlock(L);
|
lua_unlock(L);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user