To: vim_dev@googlegroups.com Subject: Patch 8.0.1412 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.1412 Problem: Using free memory using setloclist(). (Dominique Pelle) Solution: Mark location list context as still in use when needed. (Yegappan Lakshmanan, closes #2462) Files: src/quickfix.c, src/testdir/test_quickfix.vim *** ../vim-8.0.1411/src/quickfix.c 2017-12-19 10:22:15.126320001 +0100 --- src/quickfix.c 2017-12-19 12:34:24.692279054 +0100 *************** *** 5486,5491 **** --- 5486,5501 ---- if (abort) return abort; } + if (IS_LL_WINDOW(win) && (win->w_llist_ref->qf_refcount == 1)) + { + /* In a location list window and none of the other windows is + * referring to this location list. Mark the location list + * context as still in use. + */ + abort = mark_quickfix_ctx(win->w_llist_ref, copyID); + if (abort) + return abort; + } } return abort; *** ../vim-8.0.1411/src/testdir/test_quickfix.vim 2017-12-19 10:22:15.126320001 +0100 --- src/testdir/test_quickfix.vim 2017-12-19 12:34:24.692279054 +0100 *************** *** 3017,3019 **** --- 3017,3033 ---- call Xqftick_tests('c') call Xqftick_tests('l') endfunc + + " The following test used to crash Vim. + " Open the location list window and close the regular window associated with + " the location list. When the garbage collection runs now, it incorrectly + " marks the location list context as not in use and frees the context. + func Test_ll_window_ctx() + call setloclist(0, [], 'f') + call setloclist(0, [], 'a', {'context' : []}) + lopen | only + call test_garbagecollect_now() + echo getloclist(0, {'context' : 1}).context + enew | only + endfunc + *** ../vim-8.0.1411/src/version.c 2017-12-19 12:27:19.382404457 +0100 --- src/version.c 2017-12-19 12:35:46.355828344 +0100 *************** *** 773,774 **** --- 773,776 ---- { /* Add new patch number below this line */ + /**/ + 1412, /**/ -- hundred-and-one symptoms of being an internet addict: 130. You can't get out of your desk even if it's time to eat or time to go to the bathroom. /// 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 ///