diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-08-17 16:33:23 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-08-17 16:33:23 +0200 |
commit | c7226684c82dde7eb6601e067ee2e9387e447903 (patch) | |
tree | d55ec448fab23acfd82238a70db80cdae70128a4 | |
parent | ff9f27cdc7be6023f833b9d63189894839df9655 (diff) | |
download | vim-git-c7226684c82dde7eb6601e067ee2e9387e447903.tar.gz |
patch 8.1.1872: when Vim exits because of a signal, VimLeave is not triggeredv8.1.1872
Problem: When Vim exits because of a signal, VimLeave is not triggered.
(Daniel Hahler)
Solution: Unblock autocommands when triggering VimLeave. (closes #4818)
-rw-r--r-- | src/main.c | 16 | ||||
-rw-r--r-- | src/version.c | 2 |
2 files changed, 16 insertions, 2 deletions
diff --git a/src/main.c b/src/main.c index e9165c6bf..1eb49117d 100644 --- a/src/main.c +++ b/src/main.c @@ -541,12 +541,12 @@ vim_main2(void) #ifdef FEAT_GUI if (gui.starting) { -#if defined(UNIX) || defined(VMS) +# if defined(UNIX) || defined(VMS) /* When something caused a message from a vimrc script, need to output * an extra newline before the shell prompt. */ if (did_emsg || msg_didout) putchar('\n'); -#endif +# endif gui_start(NULL); /* will set full_screen to TRUE */ TIME_MSG("starting GUI"); @@ -1485,7 +1485,19 @@ getout(int exitval) #endif 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(); + } #ifdef FEAT_PROFILE profile_dump(); diff --git a/src/version.c b/src/version.c index 1d1b3f6e1..5d7da51ba 100644 --- a/src/version.c +++ b/src/version.c @@ -770,6 +770,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1872, +/**/ 1871, /**/ 1870, |