aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2004-07-09 11:20:22 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2004-07-09 11:20:22 -0300
commiteab1965c05f2ef71f715347e280733e7657993e4 (patch)
tree0eb4e7f11b5d355536d30dafab592cfac02984f1
parent3d5187f6e554d05883dbc0d7af8d9697d9f160b7 (diff)
downloadlua-eab1965c05f2ef71f715347e280733e7657993e4.tar.gz
lua-eab1965c05f2ef71f715347e280733e7657993e4.tar.bz2
lua-eab1965c05f2ef71f715347e280733e7657993e4.zip
bug: `lua_setfenv' needs a write barrier
-rw-r--r--lapi.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/lapi.c b/lapi.c
index a5b27ab7..54767481 100644
--- a/lapi.c
+++ b/lapi.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lapi.c,v 2.12 2004/06/08 14:31:00 roberto Exp roberto $ 2** $Id: lapi.c,v 2.13 2004/06/30 14:15:23 roberto Exp roberto $
3** Lua API 3** Lua API
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -677,12 +677,13 @@ LUA_API int lua_setfenv (lua_State *L, int idx) {
677 api_checknelems(L, 1); 677 api_checknelems(L, 1);
678 o = luaA_index(L, idx); 678 o = luaA_index(L, idx);
679 api_checkvalidindex(L, o); 679 api_checkvalidindex(L, o);
680 L->top--; 680 api_check(L, ttistable(L->top - 1));
681 api_check(L, ttistable(L->top));
682 if (isLfunction(o)) { 681 if (isLfunction(o)) {
683 res = 1; 682 res = 1;
684 clvalue(o)->l.g = *(L->top); 683 clvalue(o)->l.g = *(L->top - 1);
684 luaC_objbarrier(L, clvalue(o), hvalue(L->top - 1));
685 } 685 }
686 L->top--;
686 lua_unlock(L); 687 lua_unlock(L);
687 return res; 688 return res;
688} 689}