mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 03:18:16 +00:00
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.
92bb83e41c
Test_cursorhold_insert timer's 100ms delay was already LoadAdjusted, but change
to 200ms (still LoadAdjust) to match Vim anyway.
This commit is contained in:
@@ -5248,6 +5248,9 @@ search_line:
|
|||||||
if (depth == -1) {
|
if (depth == -1) {
|
||||||
// match in current file
|
// match in current file
|
||||||
if (l_g_do_tagpreview != 0) {
|
if (l_g_do_tagpreview != 0) {
|
||||||
|
if (!win_valid(curwin_save)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (!GETFILE_SUCCESS(getfile(curwin_save->w_buffer->b_fnum, NULL,
|
if (!GETFILE_SUCCESS(getfile(curwin_save->w_buffer->b_fnum, NULL,
|
||||||
NULL, true, lnum, false))) {
|
NULL, true, lnum, false))) {
|
||||||
break; // failed to jump to file
|
break; // failed to jump to file
|
||||||
|
@@ -33,7 +33,7 @@ if has('timers')
|
|||||||
let g:triggered = 0
|
let g:triggered = 0
|
||||||
au CursorHoldI * let g:triggered += 1
|
au CursorHoldI * let g:triggered += 1
|
||||||
set updatetime=20
|
set updatetime=20
|
||||||
call timer_start(LoadAdjust(100), 'ExitInsertMode')
|
call timer_start(LoadAdjust(200), 'ExitInsertMode')
|
||||||
call feedkeys('a', 'x!')
|
call feedkeys('a', 'x!')
|
||||||
call assert_equal(1, g:triggered)
|
call assert_equal(1, g:triggered)
|
||||||
unlet g:triggered
|
unlet g:triggered
|
||||||
@@ -1900,12 +1900,21 @@ endfunc
|
|||||||
func Test_autocmd_was_using_freed_memory()
|
func Test_autocmd_was_using_freed_memory()
|
||||||
pedit xx
|
pedit xx
|
||||||
n x
|
n x
|
||||||
au WinEnter * quit
|
augroup winenter
|
||||||
|
au WinEnter * if winnr('$') > 2 | quit | endif
|
||||||
|
augroup END
|
||||||
" Nvim needs large 'winwidth' and 'nowinfixwidth' to crash
|
" Nvim needs large 'winwidth' and 'nowinfixwidth' to crash
|
||||||
set winwidth=99999 nowinfixwidth
|
set winwidth=99999 nowinfixwidth
|
||||||
split
|
split
|
||||||
au! WinEnter
|
|
||||||
|
augroup winenter
|
||||||
|
au! WinEnter
|
||||||
|
augroup END
|
||||||
|
|
||||||
set winwidth& winfixwidth&
|
set winwidth& winfixwidth&
|
||||||
|
bwipe xx
|
||||||
|
bwipe x
|
||||||
|
pclose
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_FileChangedShell_reload()
|
func Test_FileChangedShell_reload()
|
||||||
@@ -2136,6 +2145,19 @@ func Test_autocmd_closes_window()
|
|||||||
au! BufWinLeave
|
au! BufWinLeave
|
||||||
endfunc
|
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
|
||||||
|
|
||||||
func Test_autocmd_closing_cmdwin()
|
func Test_autocmd_closing_cmdwin()
|
||||||
au BufWinLeave * nested q
|
au BufWinLeave * nested q
|
||||||
call assert_fails("norm 7q?\n", 'E855:')
|
call assert_fails("norm 7q?\n", 'E855:')
|
||||||
|
Reference in New Issue
Block a user