diff src/window.c @ 5958:f7bc601823e5 v7.4.320

updated for version 7.4.320 Problem: Possible crash when an BufLeave autocommand deletes the buffer. Solution: Check for the window pointer being valid. Postpone freeing the window until autocommands are done. (Yasuhiro Matsumoto)
author Bram Moolenaar <bram@vim.org>
date Thu, 12 Jun 2014 14:01:31 +0200
parents 8ffcb546d782
children 1f288d247548
line wrap: on
line diff
--- a/src/window.c
+++ b/src/window.c
@@ -4597,7 +4597,13 @@ win_free(wp, tp)
     if (wp != aucmd_win)
 #endif
 	win_remove(wp, tp);
-    vim_free(wp);
+    if (autocmd_busy)
+    {
+	wp->w_next = au_pending_free_win;
+	au_pending_free_win = wp;
+    }
+    else
+	vim_free(wp);
 
 #ifdef FEAT_AUTOCMD
     unblock_autocmds();