diff src/buffer.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 373204662d82
children 72ee0db83788
line wrap: on
line diff
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -371,7 +371,11 @@ close_buffer(win, buf, action, abort_if_
 	unload_buf = TRUE;
 #endif
 
-    if (win != NULL)
+    if (win != NULL
+#ifdef FEAT_WINDOWS
+	&& win_valid(win)	/* in case autocommands closed the window */
+#endif
+	    )
     {
 	/* Set b_last_cursor when closing the last window for the buffer.
 	 * Remember the last cursor position and window options of the buffer.