diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2009-02-17 16:47:58 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2009-02-17 16:47:58 -0300 |
commit | d07abcc6c7064040c15444a7727c39c707130f60 (patch) | |
tree | d7969668498d5284741515fbfa701dc696792813 /lgc.c | |
parent | 189378142a70398ad538af66b62430bc9ea3c645 (diff) | |
download | lua-d07abcc6c7064040c15444a7727c39c707130f60.tar.gz lua-d07abcc6c7064040c15444a7727c39c707130f60.tar.bz2 lua-d07abcc6c7064040c15444a7727c39c707130f60.zip |
finalizers always called protected
Diffstat (limited to 'lgc.c')
-rw-r--r-- | lgc.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -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 | ||
602 | static void dothecall (lua_State *L, void *ud) { | ||
603 | UNUSED(ud); | ||
604 | luaD_call(L, L->top - 2, 0); | ||
605 | } | ||
606 | |||
607 | |||
602 | static void GCTM (lua_State *L) { | 608 | static 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 | } |