Problem: Using freed memory with "wincmd p". (Dominique Pelle)
Solution: Also clear "prevwin" in other tab pages.
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1704,
/**/
1703,
/**/
/* cursor to last accessed (previous) window */
case 'p':
case Ctrl_P:
- if (prevwin == NULL)
+ if (!win_valid(prevwin))
beep_flush();
else
win_goto(prevwin);
unref_var_dict(wp->w_vars);
#endif
- if (prevwin == wp)
- prevwin = NULL;
+ {
+ tabpage_T *ttp;
+
+ if (prevwin == wp)
+ prevwin = NULL;
+ for (ttp = first_tabpage; ttp != NULL; ttp = ttp->tp_next)
+ if (ttp->tp_prevwin == wp)
+ ttp->tp_prevwin = NULL;
+ }
win_free_lsize(wp);
for (i = 0; i < wp->w_tagstacklen; ++i)