aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-12-20 20:26:27 -0500
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-12-20 20:36:55 -0500
commitd1142e02bf943aa40a80e0bdbf0687d65df4dfa2 (patch)
tree521dcdf10e0f5c3c25ff78a96100c7aa611766d0
parenta1ec36ff31ff1fd545dd135faa47dc782b41a687 (diff)
downloadrneovim-d1142e02bf943aa40a80e0bdbf0687d65df4dfa2.tar.gz
rneovim-d1142e02bf943aa40a80e0bdbf0687d65df4dfa2.tar.bz2
rneovim-d1142e02bf943aa40a80e0bdbf0687d65df4dfa2.zip
vim-patch:8.1.1872: when Vim exits because of a signal, VimLeave is not triggered
Problem: When Vim exits because of a signal, VimLeave is not triggered. (Daniel Hahler) Solution: Unblock autocommands when triggering VimLeave. (closes vim/vim#4818) https://github.com/vim/vim/commit/c7226684c82dde7eb6601e067ee2e9387e447903
-rw-r--r--src/nvim/autocmd.c3
-rw-r--r--src/nvim/main.c10
2 files changed, 12 insertions, 1 deletions
diff --git a/src/nvim/autocmd.c b/src/nvim/autocmd.c
index 53b11c250e..7a21acd7e3 100644
--- a/src/nvim/autocmd.c
+++ b/src/nvim/autocmd.c
@@ -1717,7 +1717,8 @@ void unblock_autocmds(void)
}
}
-static inline bool is_autocmd_blocked(void)
+bool is_autocmd_blocked(void)
+ FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
{
return autocmd_blocked != 0;
}
diff --git a/src/nvim/main.c b/src/nvim/main.c
index fd8264583b..ed055e76ba 100644
--- a/src/nvim/main.c
+++ b/src/nvim/main.c
@@ -662,7 +662,17 @@ void getout(int exitval)
}
if (v_dying <= 1) {
+ int unblock = 0;
+
+ // deathtrap() blocks autocommands, but we do want to trigger VimLeave.
+ if (is_autocmd_blocked()) {
+ unblock_autocmds();
+ unblock++;
+ }
apply_autocmds(EVENT_VIMLEAVE, NULL, NULL, false, curbuf);
+ if (unblock) {
+ block_autocmds();
+ }
}
profile_dump();