aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Edmund Lazo <janedmundlazo@hotmail.com>2018-08-24 21:16:34 -0400
committerJan Edmund Lazo <janedmundlazo@hotmail.com>2018-08-24 21:19:13 -0400
commitbdffa01b528ca6093fc8e0e4f54f810f9bb6d3b7 (patch)
tree850b752a651e8bdc33588ea614c3b106661cf72c
parent59b53e7bc7ef1d2e92725564f0a0e56cb6034daa (diff)
downloadrneovim-bdffa01b528ca6093fc8e0e4f54f810f9bb6d3b7.tar.gz
rneovim-bdffa01b528ca6093fc8e0e4f54f810f9bb6d3b7.tar.bz2
rneovim-bdffa01b528ca6093fc8e0e4f54f810f9bb6d3b7.zip
vim-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 vim/vim#2449) https://github.com/vim/vim/commit/606d45ccd8a2ad2956e2729f6135fd79fd2f6d72
-rw-r--r--src/nvim/main.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/nvim/main.c b/src/nvim/main.c
index 96c2168bca..af7c194edc 100644
--- a/src/nvim/main.c
+++ b/src/nvim/main.c
@@ -605,9 +605,14 @@ void getout(int exitval)
buf_T *buf = wp->w_buffer;
if (buf_get_changedtick(buf) != -1) {
+ bufref_T bufref;
+
+ set_bufref(&bufref, buf);
apply_autocmds(EVENT_BUFWINLEAVE, buf->b_fname,
buf->b_fname, false, buf);
- buf_set_changedtick(buf, -1); // note that we did it already
+ if (bufref_valid(&bufref)) {
+ buf_set_changedtick(buf, -1); // note that we did it already
+ }
// start all over, autocommands may mess up the lists
next_tp = first_tabpage;
break;