diff options
-rw-r--r-- | lgc.c | 4 | ||||
-rw-r--r-- | lstate.h | 3 |
2 files changed, 5 insertions, 2 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lgc.c,v 2.211 2015/12/10 18:12:30 roberto Exp roberto $ | 2 | ** $Id: lgc.c,v 2.212 2016/03/31 19:02:03 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 | */ |
@@ -818,7 +818,9 @@ static void GCTM (lua_State *L, int propagateerrors) { | |||
818 | setobj2s(L, L->top, tm); /* push finalizer... */ | 818 | setobj2s(L, L->top, tm); /* push finalizer... */ |
819 | setobj2s(L, L->top + 1, &v); /* ... and its argument */ | 819 | setobj2s(L, L->top + 1, &v); /* ... and its argument */ |
820 | L->top += 2; /* and (next line) call the finalizer */ | 820 | L->top += 2; /* and (next line) call the finalizer */ |
821 | L->ci->callstatus |= CIST_FIN; /* will run a finalizer */ | ||
821 | status = luaD_pcall(L, dothecall, NULL, savestack(L, L->top - 2), 0); | 822 | status = luaD_pcall(L, dothecall, NULL, savestack(L, L->top - 2), 0); |
823 | L->ci->callstatus &= ~CIST_FIN; /* not running a finalizer anymore */ | ||
822 | L->allowhook = oldah; /* restore hooks */ | 824 | L->allowhook = oldah; /* restore hooks */ |
823 | g->gcrunning = running; /* restore state */ | 825 | g->gcrunning = running; /* restore state */ |
824 | if (status != LUA_OK && propagateerrors) { /* error while running __gc? */ | 826 | if (status != LUA_OK && propagateerrors) { /* error while running __gc? */ |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstate.h,v 2.130 2015/12/16 16:39:38 roberto Exp roberto $ | 2 | ** $Id: lstate.h,v 2.131 2016/06/16 13:36:09 roberto Exp roberto $ |
3 | ** Global State | 3 | ** Global State |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -104,6 +104,7 @@ typedef struct CallInfo { | |||
104 | #define CIST_TAIL (1<<5) /* call was tail called */ | 104 | #define CIST_TAIL (1<<5) /* call was tail called */ |
105 | #define CIST_HOOKYIELD (1<<6) /* last hook called yielded */ | 105 | #define CIST_HOOKYIELD (1<<6) /* last hook called yielded */ |
106 | #define CIST_LEQ (1<<7) /* using __lt for __le */ | 106 | #define CIST_LEQ (1<<7) /* using __lt for __le */ |
107 | #define CIST_FIN (1<<8) /* call is running a finalizer */ | ||
107 | 108 | ||
108 | #define isLua(ci) ((ci)->callstatus & CIST_LUA) | 109 | #define isLua(ci) ((ci)->callstatus & CIST_LUA) |
109 | 110 | ||