diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-07-09 15:21:02 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-07-09 15:21:02 +0200 |
commit | 30445cb6e94698d212ba866ef3e4022ac625540a (patch) | |
tree | 70ded697cac9ceb7da59dcb6ab3b706e90c9dc1c /src/buffer.c | |
parent | ee1deb4a00f39f133558321ec535354497f490c8 (diff) |
patch 7.4.2006v7.4.2006
Problem: Crash when using tabnext in BufUnload autocmd. (Norio Takagi)
Solution: First check that the current buffer is the right one. (Hirohito
Higashi)
Diffstat (limited to 'src/buffer.c')
-rw-r--r-- | src/buffer.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/src/buffer.c b/src/buffer.c index 058e4d785b..7c69b8e9d7 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -459,14 +459,6 @@ aucmd_abort: #endif buf_freeall(buf, (del_buf ? BFA_DEL : 0) + (wipe_buf ? BFA_WIPE : 0)); - if ( -#ifdef FEAT_WINDOWS - win_valid(win) && -#else - win != NULL && -#endif - win->w_buffer == buf) - win->w_buffer = NULL; /* make sure we don't use the buffer now */ #ifdef FEAT_AUTOCMD /* Autocommands may have deleted the buffer. */ @@ -477,11 +469,6 @@ aucmd_abort: return; # endif - /* Autocommands may have opened or closed windows for this buffer. - * Decrement the count for the close we do here. */ - if (buf->b_nwindows > 0) - --buf->b_nwindows; - /* * It's possible that autocommands change curbuf to the one being deleted. * This might cause the previous curbuf to be deleted unexpectedly. But @@ -491,6 +478,20 @@ aucmd_abort: */ if (buf == curbuf && !is_curbuf) return; + + if ( +#ifdef FEAT_WINDOWS + win_valid(win) && +#else + win != NULL && +#endif + win->w_buffer == buf) + win->w_buffer = NULL; /* make sure we don't use the buffer now */ + + /* Autocommands may have opened or closed windows for this buffer. + * Decrement the count for the close we do here. */ + if (buf->b_nwindows > 0) + --buf->b_nwindows; #endif /* Change directories when the 'acd' option is set. */ |