fix(buffer): disable buffer-updates before removing from window #18933

There can be other places that access window buffer info (e.g.
`tabpagebuflist()`), so checking `w_closing` in `win_findbuf()` doesn't
solve the crash in all cases, and may also cause Nvim's behavior to
diverge from Vim.

Fix #14998
This commit is contained in:
zeertzjq
2022-06-13 06:02:00 +08:00
committed by GitHub
parent feba56af7d
commit 429c40cce3
3 changed files with 13 additions and 8 deletions

View File

@@ -7297,7 +7297,7 @@ void win_findbuf(typval_T *argvars, list_T *list)
int bufnr = tv_get_number(&argvars[0]);
FOR_ALL_TAB_WINDOWS(tp, wp) {
if (!wp->w_closing && wp->w_buffer->b_fnum == bufnr) {
if (wp->w_buffer->b_fnum == bufnr) {
tv_list_append_number(list, wp->handle);
}
}