[RFC] vim-patch:7.4.1704 (#5487)

vim-patch:7.4.1704

Problem:    Using freed memory with "wincmd p". (Dominique Pelle)
Solution:   Also clear "prevwin" in other tab pages.

3dda7db4e1
This commit is contained in:
Michael Ennen 2016-10-21 09:55:57 -07:00 committed by James McCoy
parent 6636e2a259
commit 82f30bfeda
2 changed files with 12 additions and 4 deletions

View File

@ -739,7 +739,7 @@ static int included_patches[] = {
// 1707,
// 1706 NA
// 1705 NA
// 1704,
1704,
1703,
// 1702,
// 1701,

View File

@ -278,10 +278,11 @@ newwindow:
/* cursor to last accessed (previous) window */
case 'p':
case Ctrl_P:
if (prevwin == NULL)
if (!win_valid(prevwin)) {
beep_flush();
else
} else {
win_goto(prevwin);
}
break;
/* exchange current and next window */
@ -3768,8 +3769,15 @@ win_free (
hash_init(&wp->w_vars->dv_hashtab);
unref_var_dict(wp->w_vars);
if (prevwin == wp)
if (prevwin == wp) {
prevwin = NULL;
}
FOR_ALL_TABS(ttp) {
if (ttp->tp_prevwin == wp) {
ttp->tp_prevwin = NULL;
}
}
win_free_lsize(wp);
for (i = 0; i < wp->w_tagstacklen; ++i)