diff src/quickfix.c @ 14111:678e326bf7eb v8.1.0073

patch 8.1.0073: crash when autocommands call setloclist() commit https://github.com/vim/vim/commit/0366c0161e988e32420d2f37111a60129684905b Author: Bram Moolenaar <Bram@vim.org> Date: Mon Jun 18 20:52:13 2018 +0200 patch 8.1.0073: crash when autocommands call setloclist() Problem: Crash when autocommands call setloclist(). (Dominique Pelle) Solution: If the quickfix list changes then don't jump to the error.
author Christian Brabandt <cb@256bit.org>
date Mon, 18 Jun 2018 21:00:07 +0200
parents 59e76d550c10
children b75df03789f8
line wrap: on
line diff
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -6348,9 +6348,11 @@ ex_cexpr(exarg_T *eap)
 	    if (au_name != NULL)
 		apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name,
 						curbuf->b_fname, TRUE, curbuf);
-	    if (res > 0 && (eap->cmdidx == CMD_cexpr ||
-						eap->cmdidx == CMD_lexpr))
-		qf_jump(qi, 0, 0, eap->forceit);  /* display first error */
+	    if (res > 0 && (eap->cmdidx == CMD_cexpr
+						   || eap->cmdidx == CMD_lexpr)
+		    && qi == ll_get_or_alloc_list(curwin))
+		// Jump to the first error if autocmds didn't free the list.
+		qf_jump(qi, 0, 0, eap->forceit);
 	}
 	else
 	    EMSG(_("E777: String or List expected"));