1
0
forked from aniani/vim

patch 8.2.2465: using freed memory in :psearch

Problem:    Using freed memory in :psearch. (houyunsong)
Solution:   Check the current window is still valid.  Fix flaky test.
This commit is contained in:
Bram Moolenaar
2021-02-03 23:04:46 +01:00
parent 8ab375706e
commit 92bb83e41c
3 changed files with 29 additions and 3 deletions

View File

@@ -3864,6 +3864,8 @@ search_line:
#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)))

View File

@@ -60,7 +60,7 @@ if has('timers')
let g:triggered = 0
au CursorHoldI * let g:triggered += 1
set updatetime=20
call timer_start(100, 'ExitInsertMode')
call timer_start(200, 'ExitInsertMode')
call feedkeys('a', 'x!')
call assert_equal(1, g:triggered)
unlet g:triggered
@@ -2413,9 +2413,18 @@ func Test_autocmd_was_using_freed_memory()
pedit xx
n x
au WinEnter * quit
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,4 +2746,17 @@ func Test_autocmd_closes_window()
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

View File

@@ -750,6 +750,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
2465,
/**/
2464,
/**/