mirror of
https://github.com/neovim/neovim.git
synced 2025-09-16 16:28:17 +00:00
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)
c7226684c8
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
@@ -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();
|
||||
|
Reference in New Issue
Block a user