summaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-05-16 16:08:35 +0200
committerBram Moolenaar <Bram@vim.org>2020-05-16 16:08:35 +0200
commit129d6bf6b3d120b0a4c69e18b5e8602a84e352bf (patch)
tree0634cab073ab0767b0e99b20a8e72ea8d9121ff9 /src/main.c
parente75ba268b35a9b3a1f8b47668e657259555fc5fa (diff)
patch 8.2.0769: VimLeavePre not triggered when Vim is terminatedv8.2.0769
Problem: VimLeavePre not triggered when Vim is terminated. Solution: Unblock autocommands.
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index b00d7b987f..201ed37211 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1576,6 +1576,7 @@ getout(int exitval)
tabpage_T *next_tp;
buf_T *buf;
win_T *wp;
+ int unblock = 0;
// Trigger BufWinLeave for all windows, but only once per buffer.
for (tp = first_tabpage; tp != NULL; tp = next_tp)
@@ -1617,7 +1618,17 @@ getout(int exitval)
// autocmd deleted the buffer
break;
}
+
+ // deathtrap() blocks autocommands, but we do want to trigger
+ // VimLeavePre.
+ if (is_autocmd_blocked())
+ {
+ unblock_autocmds();
+ ++unblock;
+ }
apply_autocmds(EVENT_VIMLEAVEPRE, NULL, NULL, FALSE, curbuf);
+ if (unblock)
+ block_autocmds();
}
#ifdef FEAT_VIMINFO