Mercurial > vim
diff src/window.c @ 8833:dc10bd23f918 v7.4.1704
commit https://github.com/vim/vim/commit/3dda7db4e1f7c4a8110a1f83001ec36b46693d27
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Apr 3 21:22:58 2016 +0200
patch 7.4.1704
Problem: Using freed memory with "wincmd p". (Dominique Pelle)
Solution: Also clear "prevwin" in other tab pages.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 03 Apr 2016 21:30:04 +0200 |
parents | 75446578a52f |
children | 0e90f3e13d88 |
line wrap: on
line diff
--- a/src/window.c +++ b/src/window.c @@ -340,7 +340,7 @@ newwindow: /* cursor to last accessed (previous) window */ case 'p': case Ctrl_P: - if (prevwin == NULL) + if (!win_valid(prevwin)) beep_flush(); else win_goto(prevwin); @@ -4577,8 +4577,15 @@ win_free( 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)