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 -- [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/202102061709.116H9Crg2612117%40masaka.moolenaar.net.

Raspunde prin e-mail lui