From dc52cf68febc147c01f55f349a90e0e7dfa74a12 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+orbitalquark@users.noreply.github.com> Date: Sun, 4 Oct 2020 10:20:58 -0400 Subject: Collect garbage on reset. External modules that have finalizers (__gc metamethod) need to be run now, or else segfaults can occur when running the gc later with stale data. --- src/textadept.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/textadept.c') diff --git a/src/textadept.c b/src/textadept.c index 6ed6163a..994002c1 100644 --- a/src/textadept.c +++ b/src/textadept.c @@ -1559,6 +1559,7 @@ static bool init_lua(lua_State *L, int argc, char **argv, bool reinit) { while (lua_pushnil(L), lua_next(L, -2)) lua_pushnil(L), lua_replace(L, -2), lua_rawset(L, -3); // clear lua_pop(L, 2); // package.loaded, _G + lua_gc(L, LUA_GCCOLLECT, 0); } lua_pushinteger(L, (intptr_t)L), lua_setglobal(L, "_LUA"); // for LPeg lexer luaL_openlibs(L); -- cgit v1.2.3