vim-patch:8.2.2464: using freed memory if window closed in autocommand

Problem:    Using freed memory if window closed in autocommand. (houyunsong)
Solution:   Check the window still exists.
8ab375706e
This commit is contained in:
Jan Edmund Lazo
2021-02-03 18:38:46 -05:00
parent 02cda35cf7
commit da3f9778af
2 changed files with 15 additions and 1 deletions

View File

@@ -2416,7 +2416,10 @@ int do_ecmd(
(flags & ECMD_HIDE) || curbuf->terminal ? 0 : DOBUF_UNLOAD,
false);
the_curwin->w_closing = false;
// Autocommands may have closed the window.
if (win_valid(the_curwin)) {
the_curwin->w_closing = false;
}
buf->b_locked--;
// autocmds may abort script processing