diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2021-02-03 18:38:46 -0500 |
---|---|---|
committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2021-02-03 18:46:53 -0500 |
commit | da3f9778aff8cfa134adec3fca93c00d82bcf4af (patch) | |
tree | 383bcd68ec0808f26d14ebb727fc06257be5c4c9 /src/nvim/ex_cmds.c | |
parent | 02cda35cf7258e1d33c86f792aec30bd506221dc (diff) | |
download | rneovim-da3f9778aff8cfa134adec3fca93c00d82bcf4af.tar.gz rneovim-da3f9778aff8cfa134adec3fca93c00d82bcf4af.tar.bz2 rneovim-da3f9778aff8cfa134adec3fca93c00d82bcf4af.zip |
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.
https://github.com/vim/vim/commit/8ab375706e6712308f8cf7529bcae56684a6f385
Diffstat (limited to 'src/nvim/ex_cmds.c')
-rw-r--r-- | src/nvim/ex_cmds.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index 6b96c4deca..9239eb5ca6 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -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 |