diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2021-03-27 17:15:04 +0100 |
---|---|---|
committer | Björn Linse <bjorn.linse@gmail.com> | 2021-04-03 16:27:58 +0200 |
commit | 7e799502e513bd2e60120012b069eb67c1c511e7 (patch) | |
tree | 1d36a1c758117d365e423622c479f54540972604 /src/nvim/eval/typval.c | |
parent | 623fe4dc7ede5d292bca66e0a132975b16a7c825 (diff) | |
download | rneovim-7e799502e513bd2e60120012b069eb67c1c511e7.tar.gz rneovim-7e799502e513bd2e60120012b069eb67c1c511e7.tar.bz2 rneovim-7e799502e513bd2e60120012b069eb67c1c511e7.zip |
luaref: simplify handling of table callables and fix leak in vim.fn.call(table)
I AM THE TABLE
Diffstat (limited to 'src/nvim/eval/typval.c')
-rw-r--r-- | src/nvim/eval/typval.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/nvim/eval/typval.c b/src/nvim/eval/typval.c index fe3d147040..71e4edc667 100644 --- a/src/nvim/eval/typval.c +++ b/src/nvim/eval/typval.c @@ -219,6 +219,7 @@ list_T *tv_list_alloc(const ptrdiff_t len) list->lv_used_next = gc_first_list; gc_first_list = list; list_log(list, NULL, (void *)(uintptr_t)len, "alloc"); + list->lua_table_ref = LUA_NOREF; return list; } @@ -302,7 +303,7 @@ void tv_list_free_list(list_T *const l) } list_log(l, NULL, NULL, "freelist"); - nlua_free_typval_list(l); + NLUA_CLEAR_REF(l->lua_table_ref); xfree(l); } @@ -1404,6 +1405,8 @@ dict_T *tv_dict_alloc(void) d->dv_copyID = 0; QUEUE_INIT(&d->watchers); + d->lua_table_ref = LUA_NOREF; + return d; } @@ -1454,7 +1457,7 @@ void tv_dict_free_dict(dict_T *const d) d->dv_used_next->dv_used_prev = d->dv_used_prev; } - nlua_free_typval_dict(d); + NLUA_CLEAR_REF(d->lua_table_ref); xfree(d); } |