diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-02-03 21:56:59 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-02-03 21:56:59 +0100 |
commit | 8ab375706e6712308f8cf7529bcae56684a6f385 (patch) | |
tree | 2bb4334168ae77eca7c116f89b84ecb1807871a4 /src/ex_cmds.c | |
parent | 6bcb877ec19a647443195a54eeac60cb693fd827 (diff) | |
download | vim-git-8ab375706e6712308f8cf7529bcae56684a6f385.tar.gz |
patch 8.2.2464: using freed memory if window closed in autocommandv8.2.2464
Problem: Using freed memory if window closed in autocommand. (houyunsong)
Solution: Check the window still exists.
Diffstat (limited to 'src/ex_cmds.c')
-rw-r--r-- | src/ex_cmds.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/ex_cmds.c b/src/ex_cmds.c index b678f6699..b6e1cbf7f 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -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 |