aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-04-26 19:17:24 -0400
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-04-26 19:20:20 -0400
commit94e7f30dbbbed8acfd9412ff864f8cd26712b00d (patch)
treebab1ddd694247c7ffe0f50f2039d24050f1a6b7c
parent5b3ec39df379ae01d6046689ffd9fb265196d21a (diff)
downloadrneovim-94e7f30dbbbed8acfd9412ff864f8cd26712b00d.tar.gz
rneovim-94e7f30dbbbed8acfd9412ff864f8cd26712b00d.tar.bz2
rneovim-94e7f30dbbbed8acfd9412ff864f8cd26712b00d.zip
vim-patch:8.1.1264: crash when closing window from WinBar click
Problem: Crash when closing window from WinBar click. (Ben Jackson) Solution: Check that window pointer is still valid. (closes vim/vim#4337) https://github.com/vim/vim/commit/d2fad67e3eb71f48d23f283ef8e7b7ddf4ee180f
-rw-r--r--src/nvim/menu.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/nvim/menu.c b/src/nvim/menu.c
index 9d37035247..b060464383 100644
--- a/src/nvim/menu.c
+++ b/src/nvim/menu.c
@@ -28,6 +28,7 @@
#include "nvim/ui.h"
#include "nvim/eval/typval.h"
#include "nvim/screen.h"
+#include "nvim/window.h"
#define MENUDEPTH 10 /* maximum depth of menus */
@@ -1567,9 +1568,10 @@ void winbar_click(win_T *wp, int col)
check_cursor();
}
+ // Note: the command might close the current window.
execute_menu(NULL, item->wb_menu);
- if (save_curwin != NULL) {
+ if (save_curwin != NULL && win_valid(save_curwin)) {
curwin = save_curwin;
curbuf = curwin->w_buffer;
VIsual = save_visual;
@@ -1578,6 +1580,9 @@ void winbar_click(win_T *wp, int col)
VIsual_reselect = save_visual_reselect;
VIsual_mode = save_visual_mode;
}
+ if (!win_valid(wp)) {
+ break;
+ }
}
}
}