mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-01-19 11:31:26 +01:00
49377: fix segfault by 'bindkey -d' with reordered keymapnamtab
This commit is contained in:
parent
bb61da36aa
commit
2a7945a900
3 changed files with 41 additions and 1 deletions
|
@ -1,3 +1,8 @@
|
|||
2021-09-08 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
|
||||
|
||||
* 49377: Src/Zle/zle_keymap.c, Test/X03zlebindkey.ztst: fix
|
||||
segfalut by 'bindkey -d' with reordered keymapnamtab
|
||||
|
||||
2021-09-06 Bart Schaefer <schaefer@zsh.org>
|
||||
|
||||
* Stephane Chazelas: 45180: Doc/Zsh/contrib.yo,
|
||||
|
|
|
@ -155,7 +155,7 @@ createkeymapnamtab(void)
|
|||
keymapnamtab = newhashtable(7, "keymapnamtab", NULL);
|
||||
|
||||
keymapnamtab->hash = hasher;
|
||||
keymapnamtab->emptytable = emptyhashtable;
|
||||
keymapnamtab->emptytable = emptykeymapnamtab;
|
||||
keymapnamtab->filltable = NULL;
|
||||
keymapnamtab->cmpnodes = strcmp;
|
||||
keymapnamtab->addnode = addhashnode;
|
||||
|
@ -178,6 +178,26 @@ makekeymapnamnode(Keymap keymap)
|
|||
return kmn;
|
||||
}
|
||||
|
||||
/**/
|
||||
static void
|
||||
emptykeymapnamtab(HashTable ht)
|
||||
{
|
||||
struct hashnode *hn, *hp;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ht->hsize; i++) {
|
||||
for (hn = ht->nodes[i]; hn;) {
|
||||
KeymapName kmn = (KeymapName) hn;
|
||||
hp = hn->next;
|
||||
zsfree(kmn->nam);
|
||||
unrefkeymap(kmn->keymap);
|
||||
zfree(kmn, sizeof(*kmn));
|
||||
hn = hp;
|
||||
}
|
||||
ht->nodes[i] = NULL;
|
||||
}
|
||||
ht->ct = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Reference a keymap from a keymapname.
|
||||
|
|
|
@ -141,3 +141,18 @@
|
|||
>CURSOR: 18
|
||||
>BUFFER: echo $(( ##x ) ##x ) y
|
||||
>CURSOR: 22
|
||||
|
||||
bindkey -d
|
||||
for name in a b c d e; bindkey -N $name
|
||||
bindkey -d
|
||||
bindkey -l
|
||||
0:delete all keymaps after expanding keymapnamtab
|
||||
>.safe
|
||||
>command
|
||||
>emacs
|
||||
>isearch
|
||||
>main
|
||||
>vicmd
|
||||
>viins
|
||||
>viopp
|
||||
>visual
|
||||
|
|
Loading…
Reference in a new issue