aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/buffer.c
diff options
context:
space:
mode:
authorlonerover <pathfinder1644@yahoo.com>2016-12-28 06:39:21 +0800
committerJustin M. Keyes <justinkz@gmail.com>2016-12-27 17:39:21 -0500
commit1928b79e0ce6aa2169d735e7d6af336c74152d7a (patch)
treef0db8ba1c9005991b7b3bf8487108cf36632550f /src/nvim/buffer.c
parent9066e2356256f0416f4c61cb31edcf0a50c4f5b6 (diff)
downloadrneovim-1928b79e0ce6aa2169d735e7d6af336c74152d7a.tar.gz
rneovim-1928b79e0ce6aa2169d735e7d6af336c74152d7a.tar.bz2
rneovim-1928b79e0ce6aa2169d735e7d6af336c74152d7a.zip
vim-patch:7.4.1837 (#5834)
Problem: The BufUnload event is triggered twice, when :bunload is used with set to or . Solution: Do not trigger the event when ml_mfp is NULL. (Hirohito Higashi) https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Diffstat (limited to 'src/nvim/buffer.c')
-rw-r--r--src/nvim/buffer.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index 80db0e2ebc..d9fdc80c60 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -509,9 +509,12 @@ void buf_freeall(buf_T *buf, int flags)
// Make sure the buffer isn't closed by autocommands.
buf->b_closing = true;
- apply_autocmds(EVENT_BUFUNLOAD, buf->b_fname, buf->b_fname, FALSE, buf);
- if (!buf_valid(buf)) /* autocommands may delete the buffer */
- return;
+ if (buf->b_ml.ml_mfp != NULL) {
+ apply_autocmds(EVENT_BUFUNLOAD, buf->b_fname, buf->b_fname, false, buf);
+ if (!buf_valid(buf)) { // autocommands may delete the buffer
+ return;
+ }
+ }
if ((flags & BFA_DEL) && buf->b_p_bl) {
apply_autocmds(EVENT_BUFDELETE, buf->b_fname, buf->b_fname, FALSE, buf);
if (!buf_valid(buf)) /* autocommands may delete the buffer */