mirror of
https://github.com/neovim/neovim.git
synced 2025-09-16 08:18:17 +00:00
vim-patch:7.4.2024
Problem: More buf_valid() calls can be optimized.
Solution: Use bufref_valid() instead.
NOTE: Some changes related to channels and the Python and Netbeans interfaces
were obviously left out.
7c0a2f367f
This commit is contained in:
@@ -590,10 +590,13 @@ void getout(int exitval)
|
||||
/* Trigger BufUnload for buffers that are loaded */
|
||||
FOR_ALL_BUFFERS(buf) {
|
||||
if (buf->b_ml.ml_mfp != NULL) {
|
||||
apply_autocmds(EVENT_BUFUNLOAD, buf->b_fname, buf->b_fname,
|
||||
FALSE, buf);
|
||||
if (!buf_valid(buf)) /* autocmd may delete the buffer */
|
||||
bufref_T bufref;
|
||||
set_bufref(&bufref, buf);
|
||||
apply_autocmds(EVENT_BUFUNLOAD, buf->b_fname, buf->b_fname, false, buf);
|
||||
if (!bufref_valid(&bufref)) {
|
||||
// Autocmd deleted the buffer.
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
apply_autocmds(EVENT_VIMLEAVEPRE, NULL, NULL, FALSE, curbuf);
|
||||
|
Reference in New Issue
Block a user