diff options
author | Thomas Harning Jr <harningt@gmail.com> | 2007-11-25 17:41:30 -0500 |
---|---|---|
committer | Thomas Harning Jr <harningt@gmail.com> | 2007-11-25 17:41:30 -0500 |
commit | 9a0e90fd36e40819abe6f82085ee867293469687 (patch) | |
tree | b37dffa8fe4d05e336ef557975d3e2cb6187252a /src | |
parent | 2b1f2d177444a872b328f530ff6c6c4d6afb8889 (diff) | |
download | luaevent-prosody-9a0e90fd36e40819abe6f82085ee867293469687.tar.gz luaevent-prosody-9a0e90fd36e40819abe6f82085ee867293469687.zip |
buffer_event: Learned how to erase read/write buffer knowledge from Lua
Diffstat (limited to 'src')
-rw-r--r-- | src/buffer_event.c | 6 |
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; |