To: vim_dev@googlegroups.com Subject: Patch 7.4.2139 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.2139 Problem: :delfunction causes illegal memory access. Solution: Correct logic when deciding to free a function. Files: src/userfunc.c, src/testdir/test_lambda.vim *** ../vim-7.4.2138/src/userfunc.c 2016-08-01 15:40:24.171878515 +0200 --- src/userfunc.c 2016-08-01 15:50:11.174424639 +0200 *************** *** 2711,2717 **** * Numbered functions and lambdas snould be kept if the refcount is * one or more. */ if (fp->uf_refcount > (isdigit(fp->uf_name[0]) ! || fp->uf_name[0] == '<') ? 0 : 1) { /* Function is still referenced somewhere. Don't free it but * do remove it from the hashtable. */ --- 2711,2717 ---- * Numbered functions and lambdas snould be kept if the refcount is * one or more. */ if (fp->uf_refcount > (isdigit(fp->uf_name[0]) ! || fp->uf_name[0] == '<' ? 0 : 1)) { /* Function is still referenced somewhere. Don't free it but * do remove it from the hashtable. */ *** ../vim-7.4.2138/src/testdir/test_lambda.vim 2016-08-01 15:40:24.183878405 +0200 --- src/testdir/test_lambda.vim 2016-08-01 15:42:16.390840362 +0200 *************** *** 267,273 **** call assert_equal(2, g:Count()) call assert_equal(3, g:Count2()) ! " This causes memory access errors. ! " delfunc LambdaFoo ! " delfunc LambdaBar endfunc --- 267,272 ---- call assert_equal(2, g:Count()) call assert_equal(3, g:Count2()) ! delfunc LambdaFoo ! delfunc LambdaBar endfunc *** ../vim-7.4.2138/src/version.c 2016-08-01 16:27:19.701352907 +0200 --- src/version.c 2016-08-01 16:29:08.844326399 +0200 *************** *** 765,766 **** --- 765,768 ---- { /* Add new patch number below this line */ + /**/ + 2139, /**/ -- A disclaimer for the disclaimer: "and before I get a huge amount of complaints , I have no control over the disclaimer at the end of this mail :-)" (Timothy Aldrich) /// 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 ///