Patch 8.1.2420
Problem: Crash when calling popup_close() in win_execute().
Solution: Disallow popup_close() in popup window. (Yasuhiro Matsumoto,
closes #5345)
Files: src/popupwin.c, src/testdir/test_popupwin.vim
*** ../vim-8.1.2419/src/popupwin.c 2019-12-01 15:23:07.464344509 +0100
--- src/popupwin.c 2019-12-11 19:31:27.634385892 +0100
***************
*** 1753,1759 ****
// Check that arguments look OK.
if (argvars[0].v_type == VAR_NUMBER)
{
! buf = buflist_findnr( argvars[0].vval.v_number);
if (buf == NULL)
{
semsg(_(e_nobufnr), argvars[0].vval.v_number);
--- 1753,1759 ----
// Check that arguments look OK.
if (argvars[0].v_type == VAR_NUMBER)
{
! buf = buflist_findnr(argvars[0].vval.v_number);
if (buf == NULL)
{
semsg(_(e_nobufnr), argvars[0].vval.v_number);
***************
*** 2097,2102 ****
--- 2097,2106 ----
{
int id = wp->w_id;
+ // Just in case a check higher up is missing.
+ if (wp == curwin && ERROR_IF_POPUP_WINDOW)
+ return;
+
if (wp->w_close_cb.cb_name != NULL)
// Careful: This may make "wp" invalid.
invoke_popup_callback(wp, arg);
***************
*** 2331,2338 ****
f_popup_close(typval_T *argvars, typval_T *rettv UNUSED)
{
int id = (int)tv_get_number(argvars);
! win_T *wp = find_popup_win(id);
if (wp != NULL)
popup_close_and_callback(wp, &argvars[1]);
}
--- 2335,2346 ----
f_popup_close(typval_T *argvars, typval_T *rettv UNUSED)
{
int id = (int)tv_get_number(argvars);
! win_T *wp;
!
! if (ERROR_IF_POPUP_WINDOW)
! return;
+ wp = find_popup_win(id);
if (wp != NULL)
popup_close_and_callback(wp, &argvars[1]);
}
*** ../vim-8.1.2419/src/testdir/test_popupwin.vim 2019-12-10
23:43:09.672855573 +0100
--- src/testdir/test_popupwin.vim 2019-12-11 19:22:41.064055279 +0100
***************
*** 891,896 ****
--- 891,900 ----
let winid = popup_create('some text', {})
call assert_fails('call win_execute(winid, winnr() .. "close")', 'E994')
call popup_clear()
+
+ let winid = popup_create('some text', {})
+ call assert_fails('call win_execute(winid, printf("normal! :\<C-u>call
popup_close(%d)\<CR>", winid))', 'E994')
+ call popup_clear()
endfunc
func Test_win_execute_not_allowed()
*** ../vim-8.1.2419/src/version.c 2019-12-11 18:59:45.776537142 +0100
--- src/version.c 2019-12-11 19:22:08.544172019 +0100
***************
*** 744,745 ****
--- 744,747 ----
{ /* Add new patch number below this line */
+ /**/
+ 2420,
/**/
--
hundred-and-one symptoms of being an internet addict:
250. You've given up the search for the "perfect woman" and instead,
sit in front of the PC until you're just too tired to care.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/201912111835.xBBIZMfW005115%40masaka.moolenaar.net.