Merge pull request #5913 from mhinz/buf-lookup-patches

vim-patch:7.4.2017,7.4.2018,7.4.2021,7.4.2022,7.4.2023,7.4.2024
This commit is contained in:
James McCoy
2017-02-06 10:20:49 -05:00
committed by GitHub
21 changed files with 472 additions and 302 deletions

View File

@@ -588,10 +588,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);