diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-04-03 21:22:58 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-04-03 21:22:58 +0200 |
commit | 3dda7db4e1f7c4a8110a1f83001ec36b46693d27 (patch) | |
tree | 418c0393359c61677232c185c6c5088d26ecfe75 /src/window.c | |
parent | b50e5f56861deb867478997397f7c784a7043233 (diff) | |
download | vim-git-3dda7db4e1f7c4a8110a1f83001ec36b46693d27.tar.gz |
patch 7.4.1704v7.4.1704
Problem: Using freed memory with "wincmd p". (Dominique Pelle)
Solution: Also clear "prevwin" in other tab pages.
Diffstat (limited to 'src/window.c')
-rw-r--r-- | src/window.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/window.c b/src/window.c index c7905aec5..bbd0a527c 100644 --- 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) |