userdata with finalizers are kept in a separated list

This commit is contained in:
Roberto Ierusalimschy
2008-02-19 15:55:09 -03:00
parent fa19baab7f
commit e2b366c760
7 changed files with 187 additions and 147 deletions

8
lapi.c
View File

@@ -1,12 +1,10 @@
/*
** $Id: lapi.c,v 2.64 2008/02/12 13:34:12 roberto Exp roberto $
** $Id: lapi.c,v 2.65 2008/02/14 16:02:58 roberto Exp roberto $
** Lua API
** See Copyright Notice in lua.h
*/
#include <assert.h>
#include <math.h>
#include <stdarg.h>
#include <string.h>
@@ -698,8 +696,10 @@ LUA_API int lua_setmetatable (lua_State *L, int objindex) {
}
case LUA_TUSERDATA: {
uvalue(obj)->metatable = mt;
if (mt)
if (mt) {
luaC_objbarrier(L, rawuvalue(obj), mt);
luaC_checkfinalizer(L, rawuvalue(obj));
}
break;
}
default: {