]> granicus.if.org Git - vim/commitdiff
patch 8.1.1872: when Vim exits because of a signal, VimLeave is not triggered v8.1.1872
authorBram Moolenaar <Bram@vim.org>
Sat, 17 Aug 2019 14:33:23 +0000 (16:33 +0200)
committerBram Moolenaar <Bram@vim.org>
Sat, 17 Aug 2019 14:33:23 +0000 (16:33 +0200)
Problem:    When Vim exits because of a signal, VimLeave is not triggered.
            (Daniel Hahler)
Solution:   Unblock autocommands when triggering VimLeave. (closes #4818)

src/main.c
src/version.c

index e9165c6bfb7e30e612bfa7b1634ed85c77824f4f..1eb49117d29fe2150eec90be0c6025ff0ed5002a 100644 (file)
@@ -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();
index 1d1b3f6e17ea90ab7af6224da4306215a8c7f6ba..5d7da51ba9f23ce0dd50f97107d922c6baadd476 100644 (file)
@@ -769,6 +769,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1872,
 /**/
     1871,
 /**/