Patch 8.2.4700
Problem: Buffer remains active if a WinClosed event throws an exception.
Solution: Ignore aborting() when closing the buffer. (closes #10097)
Files: src/window.c, src/testdir/test_autocmd.vim
*** ../vim-8.2.4699/src/window.c 2022-04-03 11:22:33.524172298 +0100
--- src/window.c 2022-04-06 17:58:10.878807070 +0100
***************
*** 2493,2499 ****
set_bufref(&bufref, curbuf);
win->w_closing = TRUE;
! close_buffer(win, win->w_buffer, action, abort_if_last, FALSE);
if (win_valid_any_tab(win))
win->w_closing = FALSE;
// Make sure curbuf is valid. It can become invalid if 'bufhidden' is
--- 2493,2499 ----
set_bufref(&bufref, curbuf);
win->w_closing = TRUE;
! close_buffer(win, win->w_buffer, action, abort_if_last, TRUE);
if (win_valid_any_tab(win))
win->w_closing = FALSE;
// Make sure curbuf is valid. It can become invalid if 'bufhidden' is
*** ../vim-8.2.4699/src/testdir/test_autocmd.vim 2022-03-26
16:28:01.943874159 +0000
--- src/testdir/test_autocmd.vim 2022-04-06 17:57:16.235028885 +0100
***************
*** 348,353 ****
--- 348,370 ----
unlet g:triggered
endfunc
+ func Test_WinClosed_throws()
+ vnew
+ let bnr = bufnr()
+ call assert_equal(1, bufloaded(bnr))
+ augroup test-WinClosed
+ autocmd WinClosed * throw 'foo'
+ augroup END
+ try
+ close
+ catch /.*/
+ endtry
+ call assert_equal(0, bufloaded(bnr))
+
+ autocmd! test-WinClosed
+ augroup! test-WinClosed
+ endfunc
+
func s:AddAnAutocmd()
augroup vimBarTest
au BufReadCmd * echo 'hello'
*** ../vim-8.2.4699/src/version.c 2022-04-05 22:03:26.170738960 +0100
--- src/version.c 2022-04-06 17:45:55.301371339 +0100
***************
*** 748,749 ****
--- 748,751 ----
{ /* Add new patch number below this line */
+ /**/
+ 4700,
/**/
--
Behold the warranty! The bold print giveth and the fine print taketh.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ 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/20220406170038.CC5281C0541%40moolenaar.net.