aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/quickfix.c
diff options
context:
space:
mode:
authorTony Chen <36219739+chentau@users.noreply.github.com>2021-03-29 05:19:59 -0700
committerGitHub <noreply@github.com>2021-03-29 08:19:59 -0400
commitaa6adacd77e59b2cf2ca7bdeae9a24c062b2a9c0 (patch)
tree54cb82a3a1dd21a54d18b89978ac74a2f97653ae /src/nvim/quickfix.c
parent8665a96b92553b26c8c9c215900964b8a898595f (diff)
downloadrneovim-aa6adacd77e59b2cf2ca7bdeae9a24c062b2a9c0.tar.gz
rneovim-aa6adacd77e59b2cf2ca7bdeae9a24c062b2a9c0.tar.bz2
rneovim-aa6adacd77e59b2cf2ca7bdeae9a24c062b2a9c0.zip
Make sure window is still valid in the middle of calling :lopen (#14240)
Make sure that oldwin is not invalid after splitting Revisit this when porting vim patch v8.1.0892 and related quickfix patches.
Diffstat (limited to 'src/nvim/quickfix.c')
-rw-r--r--src/nvim/quickfix.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c
index dfd38a6eca..0785fa703d 100644
--- a/src/nvim/quickfix.c
+++ b/src/nvim/quickfix.c
@@ -3617,6 +3617,15 @@ static int qf_open_new_cwindow(qf_info_T *qi, int height)
if (win_split(height, flags) == FAIL) {
return FAIL; // not enough room for window
}
+
+ // User autocommands may have invalidated the previous window after calling
+ // win_split, so add a check to ensure that the win is still here
+ if (IS_LL_STACK(qi) && !win_valid(win)) {
+ // close the window that was supposed to be for the loclist
+ win_close(curwin, false);
+ return FAIL;
+ }
+
RESET_BINDING(curwin);
if (IS_LL_STACK(qi)) {