aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Harning Jr <harningt@gmail.com>2007-11-25 17:41:30 -0500
committerThomas Harning Jr <harningt@gmail.com>2007-11-25 17:41:30 -0500
commit9a0e90fd36e40819abe6f82085ee867293469687 (patch)
treeb37dffa8fe4d05e336ef557975d3e2cb6187252a
parent2b1f2d177444a872b328f530ff6c6c4d6afb8889 (diff)
downloadluaevent-prosody-9a0e90fd36e40819abe6f82085ee867293469687.tar.gz
luaevent-prosody-9a0e90fd36e40819abe6f82085ee867293469687.zip
buffer_event: Learned how to erase read/write buffer knowledge from Lua
-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;