From 294f557268c3b54dfea503a4e2bfd76bf42e8a04 Mon Sep 17 00:00:00 2001 From: Cloud Wu Date: Thu, 17 May 2018 12:03:03 +0800 Subject: [PATCH] lua 5.3.4 bug report 6 --- 3rd/lua/lapi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/3rd/lua/lapi.c b/3rd/lua/lapi.c index d8ee0386..1450598c 100644 --- a/3rd/lua/lapi.c +++ b/3rd/lua/lapi.c @@ -534,6 +534,7 @@ LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) { lua_lock(L); if (n == 0) { setfvalue(L->top, fn); + api_incr_top(L); } else { CClosure *cl; @@ -547,9 +548,9 @@ LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) { /* does not need barrier because closure is white */ } setclCvalue(L, L->top, cl); + api_incr_top(L); + luaC_checkGC(L); } - api_incr_top(L); - luaC_checkGC(L); lua_unlock(L); }