vim-patch:7.4.1137

Problem:    Illegal memory access when using :copen and :cclose.
Solution:   Avoid that curbuf is invalid. (suggestion by Justin M. Keyes)
            Add a test.

62ef797496
This commit is contained in:
Justin M. Keyes
2016-01-28 23:28:23 -05:00
parent aa8b3b60ee
commit aa17b4b4bc
3 changed files with 31 additions and 2 deletions

View File

@@ -1913,9 +1913,16 @@ int win_close(win_T *win, int free_buf)
*/
if (win->w_buffer != NULL) {
win->w_closing = true;
close_buffer(win, win->w_buffer, free_buf ? DOBUF_UNLOAD : 0, TRUE);
if (win_valid(win))
close_buffer(win, win->w_buffer, free_buf ? DOBUF_UNLOAD : 0, true);
if (win_valid(win)) {
win->w_closing = false;
}
// Make sure curbuf is valid. It can become invalid if 'bufhidden' is
// "wipe".
if (!buf_valid(curbuf)) {
curbuf = firstbuf;
}
}
if (only_one_window() && win_valid(win) && win->w_buffer == NULL