# HG changeset patch # User Christian Brabandt # Date 1513611005 -3600 # Node ID 1293c33ff45234487035f9b25d5b5db34b6b29d4 # Parent ddf3b9afc49b21b593a9969103c1f73bd99ab2ac patch 8.0.1404: invalid memory access on exit commit https://github.com/vim/vim/commit/606d45ccd8a2ad2956e2729f6135fd79fd2f6d72 Author: Bram Moolenaar Date: Mon Dec 18 16:21:44 2017 +0100 patch 8.0.1404: invalid memory access on exit 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) diff --git a/src/main.c b/src/main.c --- a/src/main.c +++ b/src/main.c @@ -1432,9 +1432,14 @@ getout(int exitval) 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); - CHANGEDTICK(buf) = -1; /* note that we did it already */ + 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; diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -772,6 +772,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1404, +/**/ 1403, /**/ 1402,