diff src/evalfunc.c @ 11587:439835c4b7aa v8.0.0676

patch 8.0.0676: crash when closing quickfix window in autocmd commit https://github.com/vim/vim/commit/182a17b1e80b92826204d967808df0d30eb2ef27 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jun 25 20:57:18 2017 +0200 patch 8.0.0676: crash when closing quickfix window in autocmd Problem: Crash when closing the quickfix window in a FileType autocommand that triggers when the quickfix window is opened. Solution: Save the new value before triggering the OptionSet autocommand. Add the "starting" flag to test_override() to make the text work.
author Christian Brabandt <cb@256bit.org>
date Sun, 25 Jun 2017 21:00:03 +0200
parents ef8b233f07ae
children b8299e742f41
line wrap: on
line diff
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -12398,6 +12398,7 @@ f_test_override(typval_T *argvars, typva
 {
     char_u *name = (char_u *)"";
     int     val;
+    static int save_starting = -1;
 
     if (argvars[0].v_type != VAR_STRING
 	    || (argvars[1].v_type) != VAR_NUMBER)
@@ -12411,10 +12412,29 @@ f_test_override(typval_T *argvars, typva
 	    disable_redraw_for_testing = val;
 	else if (STRCMP(name, (char_u *)"char_avail") == 0)
 	    disable_char_avail_for_testing = val;
+	else if (STRCMP(name, (char_u *)"starting") == 0)
+	{
+	    if (val)
+	    {
+		if (save_starting < 0)
+		    save_starting = starting;
+		starting = 0;
+	    }
+	    else
+	    {
+		starting = save_starting;
+		save_starting = -1;
+	    }
+	}
 	else if (STRCMP(name, (char_u *)"ALL") == 0)
 	{
 	    disable_char_avail_for_testing = FALSE;
 	    disable_redraw_for_testing = FALSE;
+	    if (save_starting >= 0)
+	    {
+		starting = save_starting;
+		save_starting = -1;
+	    }
 	}
 	else
 	    EMSG2(_(e_invarg2), name);