diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-09-04 19:50:54 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-09-04 19:50:54 +0200 |
commit | e0ab94e7123ca7855f45919114d948ef2bc1e8c3 (patch) | |
tree | 868d44c51ca94d1aade6e80cf07617acc1448f80 /src/window.c | |
parent | d77f9d595eb5f301b39b4373f2900a13c0ca30e2 (diff) | |
download | vim-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/window.c')
-rw-r--r-- | src/window.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/window.c b/src/window.c index 4f992711f..f61a83bb2 100644 --- a/src/window.c +++ b/src/window.c @@ -2127,7 +2127,7 @@ close_windows( { if (wp->w_buffer == buf && (!keep_curwin || wp != curwin) #ifdef FEAT_AUTOCMD - && !(wp->w_closing || wp->w_buffer->b_closing) + && !(wp->w_closing || wp->w_buffer->b_locked > 0) #endif ) { @@ -2148,7 +2148,7 @@ close_windows( for (wp = tp->tp_firstwin; wp != NULL; wp = wp->w_next) if (wp->w_buffer == buf #ifdef FEAT_AUTOCMD - && !(wp->w_closing || wp->w_buffer->b_closing) + && !(wp->w_closing || wp->w_buffer->b_locked > 0) #endif ) { @@ -2287,7 +2287,8 @@ win_close(win_T *win, int free_buf) } #ifdef FEAT_AUTOCMD - if (win->w_closing || (win->w_buffer != NULL && win->w_buffer->b_closing)) + if (win->w_closing || (win->w_buffer != NULL + && win->w_buffer->b_locked > 0)) return FAIL; /* window is already being closed */ if (win == aucmd_win) { @@ -2503,7 +2504,8 @@ win_close_othertab(win_T *win, int free_buf, tabpage_T *tp) #ifdef FEAT_AUTOCMD /* Get here with win->w_buffer == NULL when win_close() detects the tab * page changed. */ - if (win->w_closing || (win->w_buffer != NULL && win->w_buffer->b_closing)) + if (win->w_closing || (win->w_buffer != NULL + && win->w_buffer->b_locked > 0)) return; /* window is already being closed */ #endif |