summaryrefslogtreecommitdiff
path: root/src/buffer.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-05-24 16:07:40 +0200
committerBram Moolenaar <Bram@vim.org>2016-05-24 16:07:40 +0200
commitc67e89213476b5f4756d92208b57ce9ef4a4cf24 (patch)
tree0221d0098014ef0e93750d225fa6145a22468a01 /src/buffer.c
parent1d429610bf9e99a6252be8abbc910d6667e4d1da (diff)
downloadvim-c67e89213476b5f4756d92208b57ce9ef4a4cf24.zip
patch 7.4.1837
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)
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/buffer.c b/src/buffer.c
index e884f55dd..b0e3a22b5 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -574,9 +574,12 @@ buf_freeall(buf_T *buf, int flags)
int is_curbuf = (buf == curbuf);
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);