do not mess up the debt when the collector is not running

This commit is contained in:
Roberto Ierusalimschy 2017-10-31 13:29:28 -02:00
parent 1d8920dd7f
commit de9128d09d
1 changed files with 7 additions and 7 deletions

14
lgc.c
View File

@ -1,5 +1,5 @@
/* /*
** $Id: lgc.c,v 2.234 2017/08/31 16:06:51 roberto Exp roberto $ ** $Id: lgc.c,v 2.235 2017/10/11 12:38:45 roberto Exp roberto $
** Garbage Collector ** Garbage Collector
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@ -1503,12 +1503,12 @@ static void incstep (lua_State *L, global_State *g) {
*/ */
void luaC_step (lua_State *L) { void luaC_step (lua_State *L) {
global_State *g = G(L); global_State *g = G(L);
if (!g->gcrunning) /* not running? */ if (g->gcrunning) { /* running? */
luaE_setdebt(g, -MAX_LMEM); /* avoid being called without need */ if (g->gckind == KGC_INC)
else if (g->gckind == KGC_INC) incstep(L, g);
incstep(L, g); else
else genstep(L, g);
genstep(L, g); }
} }