mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
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)
606d45ccd8
This commit is contained in:
parent
59b53e7bc7
commit
bdffa01b52
@ -605,9 +605,14 @@ void getout(int exitval)
|
|||||||
|
|
||||||
buf_T *buf = wp->w_buffer;
|
buf_T *buf = wp->w_buffer;
|
||||||
if (buf_get_changedtick(buf) != -1) {
|
if (buf_get_changedtick(buf) != -1) {
|
||||||
|
bufref_T bufref;
|
||||||
|
|
||||||
|
set_bufref(&bufref, buf);
|
||||||
apply_autocmds(EVENT_BUFWINLEAVE, buf->b_fname,
|
apply_autocmds(EVENT_BUFWINLEAVE, buf->b_fname,
|
||||||
buf->b_fname, false, buf);
|
buf->b_fname, false, buf);
|
||||||
|
if (bufref_valid(&bufref)) {
|
||||||
buf_set_changedtick(buf, -1); // note that we did it already
|
buf_set_changedtick(buf, -1); // note that we did it already
|
||||||
|
}
|
||||||
// start all over, autocommands may mess up the lists
|
// start all over, autocommands may mess up the lists
|
||||||
next_tp = first_tabpage;
|
next_tp = first_tabpage;
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user