diff options
author | mitchell <70453897+orbitalquark@users.noreply.github.com> | 2020-10-04 10:20:58 -0400 |
---|---|---|
committer | mitchell <70453897+orbitalquark@users.noreply.github.com> | 2020-10-04 10:20:58 -0400 |
commit | dc52cf68febc147c01f55f349a90e0e7dfa74a12 (patch) | |
tree | f6b0edb4d74765a1b6553436e76f1ad8f8bcae9f /src/textadept.c | |
parent | 057929cc8ab7350ef6718ffbe2c1bf6c0606ee31 (diff) |
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.
Diffstat (limited to 'src/textadept.c')
-rw-r--r-- | src/textadept.c | 1 |
1 files changed, 1 insertions, 0 deletions
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); |