To: vim_dev@googlegroups.com Subject: Patch 8.2.4700 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ 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 -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///