Skip to content

Commit 606d45c

Browse files
committed
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)
1 parent 4fb921e commit 606d45c

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

src/main.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1432,9 +1432,14 @@ getout(int exitval)
14321432
buf = wp->w_buffer;
14331433
if (CHANGEDTICK(buf) != -1)
14341434
{
1435+
bufref_T bufref;
1436+
1437+
set_bufref(&bufref, buf);
14351438
apply_autocmds(EVENT_BUFWINLEAVE, buf->b_fname,
14361439
buf->b_fname, FALSE, buf);
1437-
CHANGEDTICK(buf) = -1; /* note that we did it already */
1440+
if (bufref_valid(&bufref))
1441+
CHANGEDTICK(buf) = -1; /* note we did it already */
1442+
14381443
/* start all over, autocommands may mess up the lists */
14391444
next_tp = first_tabpage;
14401445
break;

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,8 @@ static char *(features[]) =
771771

772772
static int included_patches[] =
773773
{ /* Add new patch number below this line */
774+
/**/
775+
1404,
774776
/**/
775777
1403,
776778
/**/

0 commit comments

Comments
 (0)