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)
diff --git a/src/buffer.c b/src/buffer.c
index 3c29859..7a6dbc5 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -371,7 +371,11 @@
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.