comparison src/ex_cmds.c @ 23845:7517eb94239b v8.2.2464

patch 8.2.2464: using freed memory if window closed in autocommand Commit: https://github.com/vim/vim/commit/8ab375706e6712308f8cf7529bcae56684a6f385 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Feb 3 21:56:59 2021 +0100 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.
author Bram Moolenaar <Bram@vim.org>
date Wed, 03 Feb 2021 22:00:04 +0100
parents 34a95c4bd647
children 5d11a15dbaa9
comparison
equal deleted inserted replaced
23844:0df5534e8ddb 23845:7517eb94239b
2766 // oldwin->w_buffer to NULL. 2766 // oldwin->w_buffer to NULL.
2767 u_sync(FALSE); 2767 u_sync(FALSE);
2768 did_decrement = close_buffer(oldwin, curbuf, 2768 did_decrement = close_buffer(oldwin, curbuf,
2769 (flags & ECMD_HIDE) ? 0 : DOBUF_UNLOAD, FALSE, FALSE); 2769 (flags & ECMD_HIDE) ? 0 : DOBUF_UNLOAD, FALSE, FALSE);
2770 2770
2771 the_curwin->w_closing = FALSE; 2771 // Autocommands may have closed the window.
2772 if (win_valid(the_curwin))
2773 the_curwin->w_closing = FALSE;
2772 --buf->b_locked; 2774 --buf->b_locked;
2773 2775
2774 #ifdef FEAT_EVAL 2776 #ifdef FEAT_EVAL
2775 // autocmds may abort script processing 2777 // autocmds may abort script processing
2776 if (aborting() && curwin->w_buffer != NULL) 2778 if (aborting() && curwin->w_buffer != NULL)