From: Bram Moolenaar Date: Sat, 9 Jan 2016 17:20:46 +0000 (+0100) Subject: patch 7.4.1068 X-Git-Tag: v7.4.1068 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=71bcfdf30109c3d6e40d143adcaf33964b18a70b;p=vim patch 7.4.1068 Problem: Wrong way to check for unletting internal variables. Solution: Use a better way. (Olaf Dabrunz) --- diff --git a/src/eval.c b/src/eval.c index 89407b297..dd1949228 100644 --- a/src/eval.c +++ b/src/eval.c @@ -3738,25 +3738,30 @@ do_unlet(name, forceit) ht = find_var_ht(name, &varname); if (ht != NULL && *varname != NUL) { + if (ht == &globvarht) + d = &globvardict; + else if (current_funccal != NULL + && ht == ¤t_funccal->l_vars.dv_hashtab) + d = ¤t_funccal->l_vars; + else if (ht == &compat_hashtab) + d = &vimvardict; + else + { + di = find_var_in_ht(ht, *name, (char_u *)"", FALSE); + d = di == NULL ? NULL : di->di_tv.vval.v_dict; + } + if (d == NULL) + { + EMSG2(_(e_intern2), "do_unlet()"); + return FAIL; + } hi = hash_find(ht, varname); if (!HASHITEM_EMPTY(hi)) { di = HI2DI(hi); if (var_check_fixed(di->di_flags, name, FALSE) - || var_check_ro(di->di_flags, name, FALSE)) - return FAIL; - - if (ht == &globvarht) - d = &globvardict; - else if (current_funccal != NULL - && ht == ¤t_funccal->l_vars.dv_hashtab) - d = ¤t_funccal->l_vars; - else - { - di = find_var_in_ht(ht, *name, (char_u *)"", FALSE); - d = di->di_tv.vval.v_dict; - } - if (d == NULL || tv_check_lock(d->dv_lock, name, FALSE)) + || var_check_ro(di->di_flags, name, FALSE) + || tv_check_lock(d->dv_lock, name, FALSE)) return FAIL; delete_var(ht, hi); diff --git a/src/version.c b/src/version.c index 68972921f..4bc3963c2 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1068, /**/ 1067, /**/