To: vim_dev@googlegroups.com Subject: Patch 8.0.1750 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.1750 Problem: Crash when clearing loccation list in autocommand. Solution: Check if "qi" equals "ql_info". (Yegappan Lakshmanan) Files: src/quickfix.c, src/testdir/test_quickfix.vim *** ../vim-8.0.1749/src/quickfix.c 2018-04-16 18:04:45.027723033 +0200 --- src/quickfix.c 2018-04-23 21:26:46.079127560 +0200 *************** *** 5897,5903 **** char_u *lang; #endif qf_info_T *qi = &ql_info; - qf_info_T *save_qi; int new_qi = FALSE; win_T *wp; char_u *au_name = NULL; --- 5897,5902 ---- *************** *** 5951,5959 **** } } - /* Autocommands may change the list. Save it for later comparison */ - save_qi = qi; - regmatch.regprog = vim_regcomp(eap->arg, RE_MAGIC + RE_STRING); regmatch.rm_ic = FALSE; if (regmatch.regprog != NULL) --- 5950,5955 ---- *************** *** 6086,6092 **** { apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, curbuf->b_fname, TRUE, curbuf); ! if (!new_qi && qi != save_qi && qf_find_buf(qi) == NULL) /* autocommands made "qi" invalid */ return; } --- 6082,6088 ---- { apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, curbuf->b_fname, TRUE, curbuf); ! if (!new_qi && qi != &ql_info && qf_find_buf(qi) == NULL) /* autocommands made "qi" invalid */ return; } *** ../vim-8.0.1749/src/testdir/test_quickfix.vim 2018-04-08 13:27:35.241518461 +0200 --- src/testdir/test_quickfix.vim 2018-04-23 21:24:51.307907882 +0200 *************** *** 3175,3177 **** --- 3175,3191 ---- call delete('Xtest2.txt') call setqflist([], 'f') endfunc + + " The following test used to crash Vim + func Test_lhelpgrep_autocmd() + lhelpgrep quickfix + autocmd QuickFixCmdPost * call setloclist(0, [], 'f') + lhelpgrep buffer + call assert_equal('help', &filetype) + call assert_equal(0, getloclist(0, {'nr' : '$'}).nr) + lhelpgrep tabpage + call assert_equal('help', &filetype) + call assert_equal(1, getloclist(0, {'nr' : '$'}).nr) + au! QuickFixCmdPost + new | only + endfunc *** ../vim-8.0.1749/src/version.c 2018-04-23 20:46:11.758227134 +0200 --- src/version.c 2018-04-23 21:27:16.270925624 +0200 *************** *** 763,764 **** --- 763,766 ---- { /* Add new patch number below this line */ + /**/ + 1750, /**/ -- Place mark here ->[ ]<- if you want a dirty monitor. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///