summaryrefslogtreecommitdiff
path: root/src/window.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-09-26 19:11:39 +0200
committerBram Moolenaar <Bram@vim.org>2020-09-26 19:11:39 +0200
commitf3c51bbff1256a52bdd9ede7887f40062be2628c (patch)
treee472129747c95bcd3eb6f49cd361c40b5f4ca9ce /src/window.c
parent8f187fc6304222956f94a700758a490cc8c0af99 (diff)
downloadvim-git-f3c51bbff1256a52bdd9ede7887f40062be2628c.tar.gz
patch 8.2.1748: closing split window in other tab may cause a crashv8.2.1748
Problem: Closing split window in other tab may cause a crash. Solution: Set tp_curwin properly. (Rob Pilling, closes #7018)
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/window.c b/src/window.c
index 75e049562..c73062ddd 100644
--- a/src/window.c
+++ b/src/window.c
@@ -2745,6 +2745,7 @@ win_free_mem(
{
frame_T *frp;
win_T *wp;
+ tabpage_T *win_tp = tp == NULL ? curtab : tp;
// Remove the window and its frame from the tree of frames.
frp = win->w_frame;
@@ -2752,10 +2753,10 @@ win_free_mem(
vim_free(frp);
win_free(win, tp);
- // When deleting the current window of another tab page select a new
- // current window.
- if (tp != NULL && win == tp->tp_curwin)
- tp->tp_curwin = wp;
+ // When deleting the current window in the tab, select a new current
+ // window.
+ if (win == win_tp->tp_curwin)
+ win_tp->tp_curwin = wp;
return wp;
}