Mirror of the Vim source from https://github.com/vim/vim
Révision | 5fbb167591fcf0158d77777dd5e323260f6d5027 (tree) |
---|---|
l'heure | 2019-12-12 03:45:04 |
Auteur | Bram Moolenaar <Bram@vim....> |
Commiter | Bram Moolenaar |
patch 8.1.2420: crash when calling popup_close() in win_execute()
Commit: https://github.com/vim/vim/commit/4954019c93a2bb5a0b1af54b5961c933beeb56f4
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Dec 11 19:34:54 2019 +0100
@@ -1753,7 +1753,7 @@ | ||
1753 | 1753 | // Check that arguments look OK. |
1754 | 1754 | if (argvars[0].v_type == VAR_NUMBER) |
1755 | 1755 | { |
1756 | - buf = buflist_findnr( argvars[0].vval.v_number); | |
1756 | + buf = buflist_findnr(argvars[0].vval.v_number); | |
1757 | 1757 | if (buf == NULL) |
1758 | 1758 | { |
1759 | 1759 | semsg(_(e_nobufnr), argvars[0].vval.v_number); |
@@ -2097,6 +2097,10 @@ | ||
2097 | 2097 | { |
2098 | 2098 | int id = wp->w_id; |
2099 | 2099 | |
2100 | + // Just in case a check higher up is missing. | |
2101 | + if (wp == curwin && ERROR_IF_POPUP_WINDOW) | |
2102 | + return; | |
2103 | + | |
2100 | 2104 | if (wp->w_close_cb.cb_name != NULL) |
2101 | 2105 | // Careful: This may make "wp" invalid. |
2102 | 2106 | invoke_popup_callback(wp, arg); |
@@ -2331,8 +2335,12 @@ | ||
2331 | 2335 | f_popup_close(typval_T *argvars, typval_T *rettv UNUSED) |
2332 | 2336 | { |
2333 | 2337 | int id = (int)tv_get_number(argvars); |
2334 | - win_T *wp = find_popup_win(id); | |
2335 | - | |
2338 | + win_T *wp; | |
2339 | + | |
2340 | + if (ERROR_IF_POPUP_WINDOW) | |
2341 | + return; | |
2342 | + | |
2343 | + wp = find_popup_win(id); | |
2336 | 2344 | if (wp != NULL) |
2337 | 2345 | popup_close_and_callback(wp, &argvars[1]); |
2338 | 2346 | } |
@@ -891,6 +891,10 @@ | ||
891 | 891 | let winid = popup_create('some text', {}) |
892 | 892 | call assert_fails('call win_execute(winid, winnr() .. "close")', 'E994') |
893 | 893 | call popup_clear() |
894 | + | |
895 | + let winid = popup_create('some text', {}) | |
896 | + call assert_fails('call win_execute(winid, printf("normal! :\<C-u>call popup_close(%d)\<CR>", winid))', 'E994') | |
897 | + call popup_clear() | |
894 | 898 | endfunc |
895 | 899 | |
896 | 900 | func Test_win_execute_not_allowed() |
@@ -743,6 +743,8 @@ | ||
743 | 743 | static int included_patches[] = |
744 | 744 | { /* Add new patch number below this line */ |
745 | 745 | /**/ |
746 | + 2420, | |
747 | +/**/ | |
746 | 748 | 2419, |
747 | 749 | /**/ |
748 | 750 | 2418, |