From 9fc3949841817921a14fa64ae3d657c936acdfc4 Mon Sep 17 00:00:00 2001 From: erw7 Date: Sun, 7 Jun 2020 01:31:23 +0900 Subject: shada: fix write E5004 error on exit Fix the problem of failing to write shada when the global variable contains Funcref or Partial. --- src/nvim/shada.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/nvim/shada.c b/src/nvim/shada.c index 19a14f340b..3b08c8a184 100644 --- a/src/nvim/shada.c +++ b/src/nvim/shada.c @@ -2676,6 +2676,13 @@ static ShaDaWriteResult shada_write(ShaDaWriteDef *const sd_writer, if (name == NULL) { break; } + switch (vartv.v_type) { + case VAR_FUNC: + case VAR_PARTIAL: + continue; + default: + break; + } typval_T tgttv; tv_copy(&vartv, &tgttv); ShaDaWriteResult spe_ret; -- cgit From f1cbd39f7b12d2f7a2a528dbd034bacfe72809d2 Mon Sep 17 00:00:00 2001 From: erw7 Date: Sun, 7 Jun 2020 02:00:49 +0900 Subject: vim-patch:8.2.0920: writing viminfo fails with a circular reference Problem: Writing viminfo fails with a circular reference. Solution: Use copyID to detect the cycle. (closes vim/vim#6217) https://github.com/vim/vim/commit/5b157fe2edfdce5f77080aeac2b4a03f39eb1c1a --- src/nvim/shada.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src') diff --git a/src/nvim/shada.c b/src/nvim/shada.c index 3b08c8a184..95257fe945 100644 --- a/src/nvim/shada.c +++ b/src/nvim/shada.c @@ -2679,7 +2679,30 @@ static ShaDaWriteResult shada_write(ShaDaWriteDef *const sd_writer, switch (vartv.v_type) { case VAR_FUNC: case VAR_PARTIAL: + tv_clear(&vartv); continue; + case VAR_DICT: + { + dict_T *di = vartv.vval.v_dict; + int copyID = get_copyID(); + if (!set_ref_in_ht(&di->dv_hashtab, copyID, NULL) + && copyID == di->dv_copyID) { + tv_clear(&vartv); + continue; + } + break; + } + case VAR_LIST: + { + list_T *l = vartv.vval.v_list; + int copyID = get_copyID(); + if (!set_ref_in_list(l, copyID, NULL) + && copyID == l->lv_copyID) { + tv_clear(&vartv); + continue; + } + break; + } default: break; } -- cgit