To: vim_dev@googlegroups.com Subject: Patch 8.0.1404 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.1404 Problem: Invalid memory access on exit when autocommands wipe out a buffer. (gy741, Dominique Pelle) Solution: Check if the buffer is still valid. (closes #2449) Files: src/main.c *** ../vim-8.0.1403/src/main.c 2017-11-12 19:21:06.561379665 +0100 --- src/main.c 2017-12-18 16:03:03.187765965 +0100 *************** *** 1432,1440 **** buf = wp->w_buffer; if (CHANGEDTICK(buf) != -1) { apply_autocmds(EVENT_BUFWINLEAVE, buf->b_fname, buf->b_fname, FALSE, buf); ! CHANGEDTICK(buf) = -1; /* note that we did it already */ /* start all over, autocommands may mess up the lists */ next_tp = first_tabpage; break; --- 1432,1445 ---- buf = wp->w_buffer; if (CHANGEDTICK(buf) != -1) { + bufref_T bufref; + + set_bufref(&bufref, buf); apply_autocmds(EVENT_BUFWINLEAVE, buf->b_fname, buf->b_fname, FALSE, buf); ! if (bufref_valid(&bufref)) ! CHANGEDTICK(buf) = -1; /* note we did it already */ ! /* start all over, autocommands may mess up the lists */ next_tp = first_tabpage; break; *** ../vim-8.0.1403/src/version.c 2017-12-18 15:32:55.274906330 +0100 --- src/version.c 2017-12-18 15:49:33.980822507 +0100 *************** *** 773,774 **** --- 773,776 ---- { /* Add new patch number below this line */ + /**/ + 1404, /**/ -- hundred-and-one symptoms of being an internet addict: 123. You ask the car dealer to install an extra cigarette lighter on your new car to power your notebook. /// 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 ///