mirror of
https://github.com/neovim/neovim.git
synced 2025-09-17 16:58:17 +00:00
vim-patch:9.0.0805: filetype autocmd may cause freed memory access
Problem: Filetype autocmd may cause freed memory access.
Solution: Set the quickfix-busy flag while filling the buffer.
d0fab10ed2
Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
@@ -3900,6 +3900,9 @@ static void qf_update_buffer(qf_info_T *qi, qfline_T *old_last)
|
|||||||
qf_winid = (int)win->handle;
|
qf_winid = (int)win->handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// autocommands may cause trouble
|
||||||
|
incr_quickfix_busy();
|
||||||
|
|
||||||
aco_save_T aco;
|
aco_save_T aco;
|
||||||
|
|
||||||
if (old_last == NULL) {
|
if (old_last == NULL) {
|
||||||
@@ -3924,6 +3927,9 @@ static void qf_update_buffer(qf_info_T *qi, qfline_T *old_last)
|
|||||||
if ((win = qf_find_win(qi)) != NULL && old_line_count < win->w_botline) {
|
if ((win = qf_find_win(qi)) != NULL && old_line_count < win->w_botline) {
|
||||||
redraw_buf_later(buf, UPD_NOT_VALID);
|
redraw_buf_later(buf, UPD_NOT_VALID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// always called after incr_quickfix_busy()
|
||||||
|
decr_quickfix_busy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -3298,6 +3298,21 @@ func Test_resize_from_copen()
|
|||||||
endtry
|
endtry
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_filetype_autocmd()
|
||||||
|
" this changes the location list while it is in use to fill a buffer
|
||||||
|
lexpr ''
|
||||||
|
lopen
|
||||||
|
augroup FT_loclist
|
||||||
|
au FileType * call setloclist(0, [], 'f')
|
||||||
|
augroup END
|
||||||
|
silent! lolder
|
||||||
|
lexpr ''
|
||||||
|
|
||||||
|
augroup FT_loclist
|
||||||
|
au! FileType
|
||||||
|
augroup END
|
||||||
|
endfunc
|
||||||
|
|
||||||
func Test_vimgrep_with_textlock()
|
func Test_vimgrep_with_textlock()
|
||||||
new
|
new
|
||||||
|
|
||||||
@@ -6165,4 +6180,5 @@ func Test_loclist_replace_autocmd()
|
|||||||
call setloclist(0, [], 'f')
|
call setloclist(0, [], 'f')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
|
||||||
" vim: shiftwidth=2 sts=2 expandtab
|
" vim: shiftwidth=2 sts=2 expandtab
|
||||||
|
Reference in New Issue
Block a user