diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-05-04 16:55:25 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-05-04 16:55:25 +0200 |
commit | d2fad67e3eb71f48d23f283ef8e7b7ddf4ee180f (patch) | |
tree | 7fac042cebf659320c9ae79218e1b606cf334d44 | |
parent | 66f83111520f299e688eb15e3cb95ec1fa10ba10 (diff) | |
download | vim-git-d2fad67e3eb71f48d23f283ef8e7b7ddf4ee180f.tar.gz |
patch 8.1.1264: crash when closing window from WinBar clickv8.1.1264
Problem: Crash when closing window from WinBar click. (Ben Jackson)
Solution: Check that window pointer is still valid. (closes #4337)
-rw-r--r-- | src/menu.c | 7 | ||||
-rw-r--r-- | src/version.c | 2 |
2 files changed, 7 insertions, 2 deletions
diff --git a/src/menu.c b/src/menu.c index da03322bf..21d3e1176 100644 --- a/src/menu.c +++ b/src/menu.c @@ -2488,7 +2488,7 @@ winbar_click(win_T *wp, int col) if (col >= item->wb_startcol && col <= item->wb_endcol) { - win_T *save_curwin = NULL; + win_T *save_curwin = NULL; pos_T save_visual = VIsual; int save_visual_active = VIsual_active; int save_visual_select = VIsual_select; @@ -2506,9 +2506,10 @@ winbar_click(win_T *wp, int col) check_cursor(); } + // Note: the command might close the current window. execute_menu(NULL, item->wb_menu, -1); - if (save_curwin != NULL) + if (save_curwin != NULL && win_valid(save_curwin)) { curwin = save_curwin; curbuf = curwin->w_buffer; @@ -2518,6 +2519,8 @@ winbar_click(win_T *wp, int col) VIsual_reselect = save_visual_reselect; VIsual_mode = save_visual_mode; } + if (!win_valid(wp)) + break; } } } diff --git a/src/version.c b/src/version.c index f5faef313..f2abf2400 100644 --- a/src/version.c +++ b/src/version.c @@ -768,6 +768,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1264, +/**/ 1263, /**/ 1262, |