From e7e2115de5c1a4bafdf8b0819f97a0bea8de379b Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sun, 5 Aug 2018 17:22:14 -0400 Subject: vim-patch:8.0.0948: crash if timer closes window while dragging status line Problem: Crash if timer closes window while dragging status line. Solution: Check if the window still exists. (Yasuhiro Matsumoto, closes vim/vim#1979) https://github.com/vim/vim/commit/989a70c590c2bd109eb362d3a0e48cb1427ae13d --- src/nvim/normal.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/nvim/normal.c') diff --git a/src/nvim/normal.c b/src/nvim/normal.c index a695620801..001972103c 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -3995,7 +3995,11 @@ static void nv_mousescroll(cmdarg_T *cap) col = mouse_col; /* find the window at the pointer coordinates */ - curwin = mouse_find_win(&row, &col); + win_T *const wp = mouse_find_win(&row, &col); + if (wp == NULL) { + return; + } + curwin = wp; curbuf = curwin->w_buffer; } -- cgit From 41dbb69a85302e9af5c8b76e0d8217ad7d197f8a Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sun, 5 Aug 2018 18:02:24 -0400 Subject: lint --- src/nvim/normal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/normal.c') diff --git a/src/nvim/normal.c b/src/nvim/normal.c index 001972103c..225fe4aa9a 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -3994,7 +3994,7 @@ static void nv_mousescroll(cmdarg_T *cap) row = mouse_row; col = mouse_col; - /* find the window at the pointer coordinates */ + // find the window at the pointer coordinates win_T *const wp = mouse_find_win(&row, &col); if (wp == NULL) { return; -- cgit