On Sun, May 23, 2010 at 10:58:55AM -0400, James Vega wrote: > ... > This can readily be reproduced using the attached crash.vim. > ... > The attached patch does 2) but 1) seems like a more robust (although > potentially more invasive) change.
Actually attached this time. -- James GPG Key: 1024D/61326D40 2003-09-02 James Vega <[email protected]>
fun! WipeBuffers()
for n in range(bufnr('$'))
exe n . 'bw'
endfor
endfun
au VimLeavePre * call WipeBuffers()
diff --git a/src/main.c b/src/main.c
--- a/src/main.c
+++ b/src/main.c
@@ -1247,6 +1247,9 @@
win_T *wp;
tabpage_T *tp, *next_tp;
#endif
+#ifdef UNIX
+ extern int deadly_signal;
+#endif
exiting = TRUE;
@@ -1272,6 +1275,10 @@
#endif
#ifdef FEAT_AUTOCMD
+# ifdef UNIX
+ if (deadly_signal != 0)
+ goto dying;
+# endif
/* Trigger BufWinLeave for all windows, but only once per buffer. */
# if defined FEAT_WINDOWS
for (tp = first_tabpage; tp != NULL; tp = next_tp)
@@ -1308,6 +1315,7 @@
apply_autocmds(EVENT_VIMLEAVEPRE, NULL, NULL, FALSE, curbuf);
#endif
+dying:
#ifdef FEAT_VIMINFO
if (*p_viminfo != NUL)
/* Write out the registers, history, marks etc, to the viminfo file */
@@ -1315,7 +1323,10 @@
#endif
#ifdef FEAT_AUTOCMD
- apply_autocmds(EVENT_VIMLEAVE, NULL, NULL, FALSE, curbuf);
+# ifdef UNIX
+ if (!deadly_signal)
+# endif
+ apply_autocmds(EVENT_VIMLEAVE, NULL, NULL, FALSE, curbuf);
#endif
#ifdef FEAT_PROFILE
diff --git a/src/os_unix.c b/src/os_unix.c
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -209,7 +209,7 @@
static int show_shell_mess = TRUE;
#endif
/* volatile because it is used in signal handler deathtrap(). */
-static volatile int deadly_signal = 0; /* The signal we caught */
+volatile int deadly_signal = 0; /* The signal we caught */
/* volatile because it is used in signal handler deathtrap(). */
static volatile int in_mch_delay = FALSE; /* sleeping in mch_delay() */
signature.asc
Description: Digital signature
