Patch 8.2.2473

5 views
Skip to first unread message

Bram Moolenaar

unread,
Feb 6, 2021, 12:09:19 PM2/6/21
to vim...@googlegroups.com

Patch 8.2.2473
Problem: Crash when leaving command line window triggers autocommand.
(houyunsong)
Solution: Make sure not to close the current window or buffer.
Files: src/ex_getln.c, src/testdir/test_autocmd.vim


*** ../vim-8.2.2472/src/ex_getln.c 2021-01-27 20:34:25.291292488 +0100
--- src/ex_getln.c 2021-02-06 18:08:02.967963550 +0100
***************
*** 4403,4414 ****

// win_goto() may trigger an autocommand that already closes the
// cmdline window.
! if (win_valid(wp))
win_close(wp, TRUE);

// win_close() may have already wiped the buffer when 'bh' is
! // set to 'wipe'
! if (bufref_valid(&bufref))
close_buffer(NULL, bufref.br_buf, DOBUF_WIPE, FALSE, FALSE);

// Restore window sizes.
--- 4403,4414 ----

// win_goto() may trigger an autocommand that already closes the
// cmdline window.
! if (win_valid(wp) && wp != curwin)
win_close(wp, TRUE);

// win_close() may have already wiped the buffer when 'bh' is
! // set to 'wipe', autocommands may have closed other windows
! if (bufref_valid(&bufref) && bufref.br_buf != curbuf)
close_buffer(NULL, bufref.br_buf, DOBUF_WIPE, FALSE, FALSE);

// Restore window sizes.
*** ../vim-8.2.2472/src/testdir/test_autocmd.vim 2021-02-06 17:30:26.802546808 +0100
--- src/testdir/test_autocmd.vim 2021-02-06 18:07:35.488060408 +0100
***************
*** 2774,2777 ****
--- 2774,2786 ----
augroup END
endfunc

+ func Test_autocmd_closing_cmdwin()
+ au BufWinLeave * nested q
+ call assert_fails("norm 7q?\n", 'E855:')
+
+ au! BufWinLeave
+ new
+ only
+ endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.2472/src/version.c 2021-02-06 17:30:26.802546808 +0100
--- src/version.c 2021-02-06 18:05:24.236530150 +0100
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 2473,
/**/

--
[clop clop]
GUARD #1: Halt! Who goes there?
ARTHUR: It is I, Arthur, son of Uther Pendragon, from the castle of
Camelot. King of the Britons, defeator of the Saxons, sovereign of
all England!
GUARD #1: Pull the other one!
The Quest for the Holy Grail (Monty Python)

/// Bram Moolenaar -- Br...@Moolenaar.net -- 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 ///
Reply all
Reply to author
Forward
0 new messages