0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 8.2.4225: Vim9: depth argument of :lockvar not parsed in :def function

Problem:    Vim9: depth argument of :lockvar not parsed in :def function.
Solution:   Parse the optional depth argument. (closes #9629)
            Fix that locking doesn't work for a non-materialize list.
This commit is contained in:
Bram Moolenaar
2022-01-26 21:01:15 +00:00
parent 1080c48ec8
commit 70c43d84be
9 changed files with 82 additions and 18 deletions

View File

@@ -2060,10 +2060,18 @@ item_lock(typval_T *tv, int deep, int lock, int check_refcount)
l->lv_lock |= VAR_LOCKED;
else
l->lv_lock &= ~VAR_LOCKED;
if ((deep < 0 || deep > 1) && l->lv_first != &range_list_item)
// recursive: lock/unlock the items the List contains
FOR_ALL_LIST_ITEMS(l, li)
item_lock(&li->li_tv, deep - 1, lock, check_refcount);
if (deep < 0 || deep > 1)
{
if (l->lv_first == &range_list_item)
l->lv_lock |= VAR_ITEMS_LOCKED;
else
{
// recursive: lock/unlock the items the List contains
CHECK_LIST_MATERIALIZE(l);
FOR_ALL_LIST_ITEMS(l, li) item_lock(&li->li_tv,
deep - 1, lock, check_refcount);
}
}
}
break;
case VAR_DICT: