vim-patch:7.4.2324

Problem:    Crash when editing a new buffer and BufUnload autocommand wipes
            out the new buffer. (Norio Takagi)
Solution:   Don't allow wiping out this buffer. (partly by Hirohito Higashi)
            Move old style test13 into test_autocmd. Avoid ml_get error when
            editing a file.

e0ab94e712
This commit is contained in:
Justin M. Keyes
2017-03-20 14:01:22 +01:00
parent ca853edb6f
commit 165ba3e636
9 changed files with 133 additions and 121 deletions

View File

@@ -2284,8 +2284,11 @@ int do_ecmd(
} else {
win_T *the_curwin = curwin;
// Set the w_closing flag to avoid that autocommands close the window.
// Set w_closing to avoid that autocommands close the window.
// Set b_locked for the same reason.
the_curwin->w_closing = true;
buf->b_locked++;
if (curbuf == old_curbuf.br_buf) {
buf_copy_options(buf, BCO_ENTER);
}
@@ -2298,6 +2301,7 @@ int do_ecmd(
false);
the_curwin->w_closing = false;
buf->b_locked--;
// autocmds may abort script processing
if (aborting() && curwin->w_buffer != NULL) {
@@ -2444,11 +2448,6 @@ int do_ecmd(
/* Assume success now */
retval = OK;
/*
* Reset cursor position, could be used by autocommands.
*/
check_cursor();
/*
* Check if we are editing the w_arg_idx file in the argument list.
*/