lua is managing vim objects in cache table to release with finalizer. So it 
doesn't need to call something in luaV_dict_gc/luaV_list_gc to undef vim 
objects. it makes double free.

https://gist.github.com/mattn/5356214

diff -r a079ef0ce001 src/if_lua.c
--- a/src/if_lua.c      Sat Apr 06 17:26:26 2013 +0200
+++ b/src/if_lua.c      Thu Apr 11 01:30:49 2013 +0900
@@ -665,13 +665,6 @@
 luaV_type_tostring(list, LUAVIM_LIST)
 
     static int
-luaV_list_gc (lua_State *L)
-{
-    list_unref(luaV_unbox(L, luaV_List, 1));
-    return 0;
-}
-
-    static int
 luaV_list_len (lua_State *L)
 {
     list_T *l = luaV_unbox(L, luaV_List, 1);
@@ -801,7 +794,6 @@
 
 static const luaL_Reg luaV_List_mt[] = {
     {"__tostring", luaV_list_tostring},
-    {"__gc", luaV_list_gc},
     {"__len", luaV_list_len},
     {"__call", luaV_list_call},
     {"__index", luaV_list_index},
@@ -830,13 +822,6 @@
 luaV_type_tostring(dict, LUAVIM_DICT)
 
     static int
-luaV_dict_gc (lua_State *L)
-{
-    dict_unref(luaV_unbox(L, luaV_Dict, 1));
-    return 0;
-}
-
-    static int
 luaV_dict_len (lua_State *L)
 {
     dict_T *d = luaV_unbox(L, luaV_Dict, 1);
@@ -929,7 +914,6 @@
 
 static const luaL_Reg luaV_Dict_mt[] = {
     {"__tostring", luaV_dict_tostring},
-    {"__gc", luaV_dict_gc},
     {"__len", luaV_dict_len},
     {"__call", luaV_dict_call},
     {"__index", luaV_dict_index},

- Yasuhiro Matsumoto

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Raspunde prin e-mail lui