112 lua_getfenv(L, 1); |
112 lua_getfenv(L, 1); |
113 lua_rawgeti(L, -1, READ_BUFFER_LOCATION); |
113 lua_rawgeti(L, -1, READ_BUFFER_LOCATION); |
114 lua_rawgeti(L, -2, WRITE_BUFFER_LOCATION); |
114 lua_rawgeti(L, -2, WRITE_BUFFER_LOCATION); |
115 read = event_buffer_check(L, -2); |
115 read = event_buffer_check(L, -2); |
116 write = event_buffer_check(L, -1); |
116 write = event_buffer_check(L, -1); |
|
117 /* Erase Lua's link to the buffers */ |
|
118 lua_pushnil(L); |
|
119 /* LS: ..., fenv, readBuf, writeBuf, nil */ |
|
120 lua_rawseti(L, -4, READ_BUFFER_LOCATION); |
|
121 lua_pushnil(L); |
|
122 lua_rawseti(L, -4, WRITE_BUFFER_LOCATION); |
117 /* Erase their knowledge of the buffer so that the GC won't try to double-free */ |
123 /* Erase their knowledge of the buffer so that the GC won't try to double-free */ |
118 read->buffer = NULL; |
124 read->buffer = NULL; |
119 write->buffer = NULL; |
125 write->buffer = NULL; |
120 } |
126 } |
121 return 0; |
127 return 0; |