aboutsummaryrefslogtreecommitdiff
path: root/lgc.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-03-14 15:53:42 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-03-14 15:53:42 -0300
commit8fa4f1380b9a203bfdf002c2e9e9e13ebb8384c1 (patch)
tree02cb0c4c19c563c5924b4faf7014812ea980b8c6 /lgc.c
parentb56d4e570a60a8e84df8288c3122eb5bb5c20af6 (diff)
downloadlua-8fa4f1380b9a203bfdf002c2e9e9e13ebb8384c1.tar.gz
lua-8fa4f1380b9a203bfdf002c2e9e9e13ebb8384c1.tar.bz2
lua-8fa4f1380b9a203bfdf002c2e9e9e13ebb8384c1.zip
Finalizers must be callable
Non-function __gc metamethods are not ignored; if present, the metamethod will be called even if it is not a function.
Diffstat (limited to '')
-rw-r--r--lgc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lgc.c b/lgc.c
index c834319b..8cb3e9fa 100644
--- a/lgc.c
+++ b/lgc.c
@@ -832,7 +832,7 @@ static void GCTM (lua_State *L) {
832 lua_assert(!g->gcemergency); 832 lua_assert(!g->gcemergency);
833 setgcovalue(L, &v, udata2finalize(g)); 833 setgcovalue(L, &v, udata2finalize(g));
834 tm = luaT_gettmbyobj(L, &v, TM_GC); 834 tm = luaT_gettmbyobj(L, &v, TM_GC);
835 if (ttisfunction(tm)) { /* is the finalizer a function? */ 835 if (!notm(tm)) { /* is there a finalizer? */
836 int status; 836 int status;
837 lu_byte oldah = L->allowhook; 837 lu_byte oldah = L->allowhook;
838 int running = g->gcrunning; 838 int running = g->gcrunning;