Patch 8.2.4706
Problem: Buffer remains active if a WinClosed event throws an exception
when there are multiple tabpages.
Solution: Ignore aborting() when closing the buffer. (closes #10101)
Files: src/window.c, src/testdir/test_autocmd.vim
*** ../vim-8.2.4705/src/window.c 2022-04-06 17:59:18.062549102 +0100
--- src/window.c 2022-04-07 14:03:58.606375748 +0100
***************
*** 2814,2820 ****
if (win->w_buffer != NULL)
// Close the link to the buffer.
close_buffer(win, win->w_buffer, free_buf ? DOBUF_UNLOAD : 0,
! FALSE, FALSE);
// Careful: Autocommands may have closed the tab page or made it the
// current tab page.
--- 2814,2820 ----
if (win->w_buffer != NULL)
// Close the link to the buffer.
close_buffer(win, win->w_buffer, free_buf ? DOBUF_UNLOAD : 0,
! FALSE, TRUE);
// Careful: Autocommands may have closed the tab page or made it the
// current tab page.
*** ../vim-8.2.4705/src/testdir/test_autocmd.vim 2022-04-06
17:59:18.062549102 +0100
--- src/testdir/test_autocmd.vim 2022-04-07 14:03:58.606375748 +0100
***************
*** 365,370 ****
--- 365,387 ----
augroup! test-WinClosed
endfunc
+ func Test_WinClosed_throws_with_tabs()
+ tabnew
+ 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.4705/src/version.c 2022-04-07 13:58:00.927085100 +0100
--- src/version.c 2022-04-07 14:07:45.773943754 +0100
***************
*** 748,749 ****
--- 748,751 ----
{ /* Add new patch number below this line */
+ /**/
+ 4706,
/**/
--
"I love deadlines. I especially like the whooshing sound they
make as they go flying by."
-- Douglas Adams
/// 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/20220407131013.496FA1C0917%40moolenaar.net.