From 1e6d5fdf3f15142dafef6c5bd32ebacf383460f1 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 3 Dec 2022 03:40:31 +0800 Subject: 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. https://github.com/vim/vim/commit/d0fab10ed2a86698937e3c3fed2f10bd9bb5e731 Co-authored-by: Bram Moolenaar --- src/nvim/quickfix.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/nvim/quickfix.c') diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index deac0bb8a1..d4dff746c7 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -3900,6 +3900,9 @@ static void qf_update_buffer(qf_info_T *qi, qfline_T *old_last) qf_winid = (int)win->handle; } + // autocommands may cause trouble + incr_quickfix_busy(); + aco_save_T aco; 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) { redraw_buf_later(buf, UPD_NOT_VALID); } + + // always called after incr_quickfix_busy() + decr_quickfix_busy(); } } -- cgit