Mercurial > vim
diff src/ex_cmds.c @ 5816:29eb4c2a33ac v7.4.251
updated for version 7.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)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Sun, 06 Apr 2014 20:45:43 +0200 |
parents | 80421d934ebd |
children | 75f222d67cea |
line wrap: on
line diff
--- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -3343,6 +3343,12 @@ do_ecmd(fnum, ffname, sfname, eap, newln #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;