commit ee8606d31f01eed4a3e8efb6d8279fb5b4d2845e
parent cbfae548e8944801e766f42d966b38491afa8587
Author: zeertzjq <zeertzjq@outlook.com>
Date: Tue, 26 Jul 2022 07:46:19 +0800
vim-patch:8.1.1424: crash when popup menu is deleted while waiting for char
Problem: Crash when popup menu is deleted while waiting for char.
Solution: Bail out when pum_array was cleared.
https://github.com/vim/vim/commit/5c3fb04623d0260762f1c3c1ba250a407098ff2a
Diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/nvim/popupmnu.c b/src/nvim/popupmnu.c
@@ -1054,7 +1054,10 @@ void pum_show_popupmenu(vimmenu_T *menu)
ui_flush();
int c = vgetc();
- if (c == ESC || c == Ctrl_C) {
+
+ // Bail out when typing Esc, CTRL-C or some callback closed the popup
+ // menu.
+ if (c == ESC || c == Ctrl_C || pum_array == NULL) {
break;
} else if (c == CAR || c == NL) {
// enter: select current item, if any, and close