0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

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.
This commit is contained in:
Bram Moolenaar
2022-10-20 16:03:33 +01:00
parent cdef1cefa2
commit d0fab10ed2
3 changed files with 24 additions and 0 deletions

View File

@@ -4595,6 +4595,9 @@ qf_update_buffer(qf_info_T *qi, qfline_T *old_last)
qf_winid = win->w_id;
}
// autocommands may cause trouble
incr_quickfix_busy();
if (old_last == NULL)
// set curwin/curbuf to buf and save a few things
aucmd_prepbuf(&aco, buf);
@@ -4616,6 +4619,9 @@ qf_update_buffer(qf_info_T *qi, qfline_T *old_last)
// when the added lines are not visible.
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();
}
}