summaryrefslogtreecommitdiff
path: root/src/ex_cmds.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-09-04 19:50:54 +0200
committerBram Moolenaar <Bram@vim.org>2016-09-04 19:50:54 +0200
commite0ab94e7123ca7855f45919114d948ef2bc1e8c3 (patch)
tree868d44c51ca94d1aade6e80cf07617acc1448f80 /src/ex_cmds.c
parentd77f9d595eb5f301b39b4373f2900a13c0ca30e2 (diff)
downloadvim-git-e0ab94e7123ca7855f45919114d948ef2bc1e8c3.tar.gz
patch 7.4.2324v7.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.
Diffstat (limited to 'src/ex_cmds.c')
-rw-r--r--src/ex_cmds.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index 61ab2ab12..daae0dd6f 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -3872,8 +3872,8 @@ do_ecmd(
oldbuf = TRUE;
set_bufref(&bufref, buf);
(void)buf_check_timestamp(buf, FALSE);
- /* Check if autocommands made buffer invalid or changed the current
- * buffer. */
+ /* Check if autocommands made the buffer invalid or changed the
+ * current buffer. */
if (!bufref_valid(&bufref)
#ifdef FEAT_AUTOCMD
|| curbuf != old_curbuf.br_buf
@@ -3938,8 +3938,9 @@ do_ecmd(
win_T *the_curwin = curwin;
/* Set the w_closing flag to avoid that autocommands close the
- * window. */
+ * window. And set b_locked for the same reason. */
the_curwin->w_closing = TRUE;
+ ++buf->b_locked;
if (curbuf == old_curbuf.br_buf)
#endif
@@ -3953,6 +3954,7 @@ do_ecmd(
#ifdef FEAT_AUTOCMD
the_curwin->w_closing = FALSE;
+ --buf->b_locked;
# ifdef FEAT_EVAL
/* autocmds may abort script processing */
@@ -4140,11 +4142,6 @@ do_ecmd(
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.
*/
check_arg_idx(curwin);