changeset 23746:7c730cf4fb82 v8.2.2414

patch 8.2.2414: using freed memory when closing the cmdline window Commit: https://github.com/vim/vim/commit/b7e2670b6a1de02c772af5097ba24f2a15b26eec Author: Bram Moolenaar <Bram@vim.org> Date: Tue Jan 26 22:00:52 2021 +0100 patch 8.2.2414: using freed memory when closing the cmdline window Problem: Using freed memory when closing the cmdline window. Solution: Check the window is still valid.
author Bram Moolenaar <Bram@vim.org>
date Tue, 26 Jan 2021 22:15:04 +0100
parents d4166802a11e
children f0d11de94492
files src/ex_getln.c src/version.c
diffstat 2 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -4395,10 +4395,15 @@ open_cmdwin(void)
 	// Avoid command-line window first character being concealed.
 	curwin->w_p_cole = 0;
 # endif
+	// First go back to the original window.
 	wp = curwin;
 	set_bufref(&bufref, curbuf);
 	win_goto(old_curwin);
-	win_close(wp, TRUE);
+
+	// win_goto() may trigger an autocommand that already closes the
+	// cmdline window.
+	if (win_valid(wp))
+	    win_close(wp, TRUE);
 
 	// win_close() may have already wiped the buffer when 'bh' is
 	// set to 'wipe'
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    2414,
+/**/
     2413,
 /**/
     2412,