aboutsummaryrefslogtreecommitdiff
path: root/lgc.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2009-02-17 16:47:58 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2009-02-17 16:47:58 -0300
commitd07abcc6c7064040c15444a7727c39c707130f60 (patch)
treed7969668498d5284741515fbfa701dc696792813 /lgc.c
parent189378142a70398ad538af66b62430bc9ea3c645 (diff)
downloadlua-d07abcc6c7064040c15444a7727c39c707130f60.tar.gz
lua-d07abcc6c7064040c15444a7727c39c707130f60.tar.bz2
lua-d07abcc6c7064040c15444a7727c39c707130f60.zip
finalizers always called protected
Diffstat (limited to 'lgc.c')
-rw-r--r--lgc.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/lgc.c b/lgc.c
index 598fc9d4..1fd19973 100644
--- a/lgc.c
+++ b/lgc.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lgc.c,v 2.46 2008/06/23 22:07:44 roberto Exp roberto $ 2** $Id: lgc.c,v 2.47 2008/06/26 19:42:45 roberto Exp roberto $
3** Garbage Collector 3** Garbage Collector
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -599,6 +599,12 @@ static Udata *udata2finalize (global_State *g) {
599} 599}
600 600
601 601
602static void dothecall (lua_State *L, void *ud) {
603 UNUSED(ud);
604 luaD_call(L, L->top - 2, 0);
605}
606
607
602static void GCTM (lua_State *L) { 608static void GCTM (lua_State *L) {
603 global_State *g = G(L); 609 global_State *g = G(L);
604 Udata *udata = udata2finalize(g); 610 Udata *udata = udata2finalize(g);
@@ -611,7 +617,7 @@ static void GCTM (lua_State *L) {
611 setobj2s(L, L->top, tm); 617 setobj2s(L, L->top, tm);
612 setuvalue(L, L->top+1, udata); 618 setuvalue(L, L->top+1, udata);
613 L->top += 2; 619 L->top += 2;
614 luaD_call(L, L->top - 2, 0); 620 luaD_pcall(L, dothecall, NULL, savestack(L, L->top - 2), 0);
615 L->allowhook = oldah; /* restore hooks */ 621 L->allowhook = oldah; /* restore hooks */
616 g->GCthreshold = oldt; /* restore threshold */ 622 g->GCthreshold = oldt; /* restore threshold */
617 } 623 }