aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/buffer_event.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/buffer_event.c b/src/buffer_event.c
index 7030551..12aa3ec 100644
--- a/src/buffer_event.c
+++ b/src/buffer_event.c
@@ -114,6 +114,12 @@ static int buffer_event_gc(lua_State* L) {
lua_rawgeti(L, -2, WRITE_BUFFER_LOCATION);
read = event_buffer_check(L, -2);
write = event_buffer_check(L, -1);
+ /* Erase Lua's link to the buffers */
+ lua_pushnil(L);
+ /* LS: ..., fenv, readBuf, writeBuf, nil */
+ lua_rawseti(L, -4, READ_BUFFER_LOCATION);
+ lua_pushnil(L);
+ lua_rawseti(L, -4, WRITE_BUFFER_LOCATION);
/* Erase their knowledge of the buffer so that the GC won't try to double-free */
read->buffer = NULL;
write->buffer = NULL;