summaryrefslogtreecommitdiffstats
path: root/src/ex_cmds.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2014-04-06 20:45:43 +0200
committerBram Moolenaar <Bram@vim.org>2014-04-06 20:45:43 +0200
commit4c7ab1bb5722de662db04550b74256671f20c4a2 (patch)
tree9fc51404bf8d87a9aa99df7ff30f18617f03513b /src/ex_cmds.c
parent75b8156a445fb4788dc3d1946764af30b5c50ac4 (diff)
updated for version 7.4.251v7.4.251
Problem: Crash when BufAdd autocommand wipes out the buffer. Solution: Check for buffer to still be valid. Postpone freeing the buffer structure. (Hirohito Higashi)
Diffstat (limited to 'src/ex_cmds.c')
-rw-r--r--src/ex_cmds.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index 7ae4917a8b..ac30f2c017 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -3343,6 +3343,12 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags, oldwin)
#endif
buf = buflist_new(ffname, sfname, 0L,
BLN_CURBUF | ((flags & ECMD_SET_HELP) ? 0 : BLN_LISTED));
+#ifdef FEAT_AUTOCMD
+ /* autocommands may change curwin and curbuf */
+ if (oldwin != NULL)
+ oldwin = curwin;
+ old_curbuf = curbuf;
+#endif
}
if (buf == NULL)
goto theend;