Mercurial > vim
comparison src/buffer.c @ 9106:97a9538c37ff v7.4.1837
commit https://github.com/vim/vim/commit/c67e89213476b5f4756d92208b57ce9ef4a4cf24
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue May 24 16:07:40 2016 +0200
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)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 24 May 2016 16:15:07 +0200 |
parents | d4606ae170aa |
children | 18bbf31015c2 |
comparison
equal
deleted
inserted
replaced
9105:06f8149137c9 | 9106:97a9538c37ff |
---|---|
572 { | 572 { |
573 #ifdef FEAT_AUTOCMD | 573 #ifdef FEAT_AUTOCMD |
574 int is_curbuf = (buf == curbuf); | 574 int is_curbuf = (buf == curbuf); |
575 | 575 |
576 buf->b_closing = TRUE; | 576 buf->b_closing = TRUE; |
577 apply_autocmds(EVENT_BUFUNLOAD, buf->b_fname, buf->b_fname, FALSE, buf); | 577 if (buf->b_ml.ml_mfp != NULL) |
578 if (!buf_valid(buf)) /* autocommands may delete the buffer */ | 578 { |
579 return; | 579 apply_autocmds(EVENT_BUFUNLOAD, buf->b_fname, buf->b_fname, FALSE, buf); |
580 if (!buf_valid(buf)) /* autocommands may delete the buffer */ | |
581 return; | |
582 } | |
580 if ((flags & BFA_DEL) && buf->b_p_bl) | 583 if ((flags & BFA_DEL) && buf->b_p_bl) |
581 { | 584 { |
582 apply_autocmds(EVENT_BUFDELETE, buf->b_fname, buf->b_fname, FALSE, buf); | 585 apply_autocmds(EVENT_BUFDELETE, buf->b_fname, buf->b_fname, FALSE, buf); |
583 if (!buf_valid(buf)) /* autocommands may delete the buffer */ | 586 if (!buf_valid(buf)) /* autocommands may delete the buffer */ |
584 return; | 587 return; |