Patch 8.2.2465
Problem:    Using freed memory in :psearch. (houyunsong)
Solution:   Check the current window is still valid.  Fix flaky test.
Files:      src/search.c, src/testdir/test_autocmd.vim


*** ../vim-8.2.2464/src/search.c        2021-01-04 12:41:49.507891351 +0100
--- src/search.c        2021-02-03 22:59:42.487477408 +0100
***************
*** 3864,3869 ****
--- 3864,3871 ----
  #if defined(FEAT_QUICKFIX)
                        if (g_do_tagpreview != 0)
                        {
+                           if (!win_valid(curwin_save))
+                               break;
                            if (!GETFILE_SUCCESS(getfile(
                                           curwin_save->w_buffer->b_fnum, NULL,
                                                     NULL, TRUE, lnum, FALSE)))
*** ../vim-8.2.2464/src/testdir/test_autocmd.vim        2021-02-03 
21:56:53.499701546 +0100
--- src/testdir/test_autocmd.vim        2021-02-03 23:02:48.310847964 +0100
***************
*** 60,66 ****
      let g:triggered = 0
      au CursorHoldI * let g:triggered += 1
      set updatetime=20
!     call timer_start(100, 'ExitInsertMode')
      call feedkeys('a', 'x!')
      call assert_equal(1, g:triggered)
      unlet g:triggered
--- 60,66 ----
      let g:triggered = 0
      au CursorHoldI * let g:triggered += 1
      set updatetime=20
!     call timer_start(200, 'ExitInsertMode')
      call feedkeys('a', 'x!')
      call assert_equal(1, g:triggered)
      unlet g:triggered
***************
*** 2413,2421 ****
  
    pedit xx
    n x
!   au WinEnter * quit
    split
!   au! WinEnter
  endfunc
  
  func Test_BufWrite_lockmarks()
--- 2413,2430 ----
  
    pedit xx
    n x
!   augroup winenter
!     au WinEnter * if winnr('$') > 2 | quit | endif
!   augroup END
    split
! 
!   augroup winenter
!     au! WinEnter
!   augroup END
! 
!   bwipe xx
!   bwipe x
!   pclose
  endfunc
  
  func Test_BufWrite_lockmarks()
***************
*** 2737,2740 ****
--- 2746,2762 ----
    au! BufWinLeave
  endfunc
  
+ func Test_autocmd_quit_psearch()
+   sn aa bb
+   augroup aucmd_win_test
+     au!
+     au BufEnter,BufLeave,BufNew,WinEnter,WinLeave,WinNew * if winnr('$') > 1 
| q | endif
+   augroup END
+   ps /
+ 
+   augroup aucmd_win_test
+     au!
+   augroup END
+ endfunc
+ 
  " vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.2464/src/version.c       2021-02-03 21:56:53.503701528 +0100
--- src/version.c       2021-02-03 22:25:10.025984263 +0100
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     2465,
  /**/

-- 
CONCORDE: Message for you, sir.
   He falls forward revealing the arrow with the note.
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// 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/202102032205.113M5UmQ1886731%40masaka.moolenaar.net.

Raspunde prin e-mail lui