0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

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.
This commit is contained in:
Bram Moolenaar
2021-02-03 21:56:59 +01:00
parent 6bcb877ec1
commit 8ab375706e
3 changed files with 16 additions and 1 deletions

View File

@@ -2768,7 +2768,9 @@ do_ecmd(
did_decrement = close_buffer(oldwin, curbuf,
(flags & ECMD_HIDE) ? 0 : DOBUF_UNLOAD, FALSE, 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;
#ifdef FEAT_EVAL