diff options
author | Bram Moolenaar <Bram@vim.org> | 2014-06-12 14:01:31 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2014-06-12 14:01:31 +0200 |
commit | 3be8585661f8b0a9b94e9bc1db6ebfa097c3270f (patch) | |
tree | 7dde9056432ebada1a3ce31f629eaf4f76a0d7fa /src/buffer.c | |
parent | 980e58f7b324980d40ce690506897d138e5e2b70 (diff) |
updated for version 7.4.320v7.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)
Diffstat (limited to 'src/buffer.c')
-rw-r--r-- | src/buffer.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/buffer.c b/src/buffer.c index 3c298590c6..7a6dbc5917 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -371,7 +371,11 @@ close_buffer(win, buf, action, abort_if_last) 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. |