diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2017-03-20 14:01:22 +0100 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2017-03-22 18:42:16 +0100 |
commit | 165ba3e636769c38d67285e1b8ea2966ccb00b30 (patch) | |
tree | 06dddf294d07fbb93aea6711dea72e014eba08b7 /src/nvim/window.c | |
parent | ca853edb6f9ffe1d2e5d4a63bf88e4c3a059f5fb (diff) | |
download | rneovim-165ba3e636769c38d67285e1b8ea2966ccb00b30.tar.gz rneovim-165ba3e636769c38d67285e1b8ea2966ccb00b30.tar.bz2 rneovim-165ba3e636769c38d67285e1b8ea2966ccb00b30.zip |
vim-patch:7.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.
https://github.com/vim/vim/commit/e0ab94e7123ca7855f45919114d948ef2bc1e8c3
Diffstat (limited to 'src/nvim/window.c')
-rw-r--r-- | src/nvim/window.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/nvim/window.c b/src/nvim/window.c index eda3cd7810..a737ffb33c 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -1727,7 +1727,7 @@ void close_windows(buf_T *buf, int keep_curwin) for (win_T *wp = firstwin; wp != NULL && lastwin != firstwin; ) { if (wp->w_buffer == buf && (!keep_curwin || wp != curwin) - && !(wp->w_closing || wp->w_buffer->b_closing)) { + && !(wp->w_closing || wp->w_buffer->b_locked > 0)) { if (win_close(wp, false) == FAIL) { // If closing the window fails give up, to avoid looping forever. break; @@ -1745,8 +1745,7 @@ void close_windows(buf_T *buf, int keep_curwin) if (tp != curtab) { FOR_ALL_WINDOWS_IN_TAB(wp, tp) { if (wp->w_buffer == buf - && !(wp->w_closing || wp->w_buffer->b_closing) - ) { + && !(wp->w_closing || wp->w_buffer->b_locked > 0)) { win_close_othertab(wp, FALSE, tp); /* Start all over, the tab page may be closed and @@ -1882,8 +1881,9 @@ int win_close(win_T *win, int free_buf) return FAIL; } - if (win->w_closing || (win->w_buffer != NULL && win->w_buffer->b_closing)) - return FAIL; /* window is already being closed */ + 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) { EMSG(_("E813: Cannot close autocmd window")); return FAIL; @@ -2064,7 +2064,8 @@ void win_close_othertab(win_T *win, int free_buf, tabpage_T *tp) // 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 } |