To: vim_dev@googlegroups.com Subject: Patch 8.2.2474 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.2474 Problem: Using freed memory when window is closed by autocommand. (houyunsong) Solution: Check the window pointer is still valid. Files: src/quickfix.c, src/testdir/test_autocmd.vim *** ../vim-8.2.2473/src/quickfix.c 2021-01-30 18:09:02.723958488 +0100 --- src/quickfix.c 2021-02-06 18:20:39.485415232 +0100 *************** *** 2603,2608 **** --- 2603,2610 ---- if (wp != NULL) { + if (!win_valid(wp)) + return FALSE; qi = GET_LOC_LIST(wp); // Location list if (qi == NULL) return FALSE; *** ../vim-8.2.2473/src/testdir/test_autocmd.vim 2021-02-06 18:08:39.891834143 +0100 --- src/testdir/test_autocmd.vim 2021-02-06 19:18:15.078087715 +0100 *************** *** 2783,2786 **** --- 2783,2800 ---- only endfunc + func Test_autocmd_vimgrep() + augroup aucmd_vimgrep + au QuickfixCmdPre,BufNew,BufDelete,BufReadCmd * sb + au QuickfixCmdPre,BufNew,BufDelete,BufReadCmd * q9 + augroup END + " TODO: if this is executed directly valgrind reports errors + call assert_fails('lv?a?', 'E926:') + + augroup aucmd_vimgrep + au! + augroup END + endfunc + + " vim: shiftwidth=2 sts=2 expandtab *** ../vim-8.2.2473/src/version.c 2021-02-06 18:08:39.891834143 +0100 --- src/version.c 2021-02-06 18:13:02.906931642 +0100 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 2474, /**/ -- Proverb: A nightingale that forgets the lyrics is a hummingbird. /// 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 ///