From 0f6e28f686dbb59ab3b562408ab9b2234797b9b1 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 20 Feb 2022 20:49:35 +0000 Subject: [PATCH] patch 8.2.4428: crash when switching tabpage while in the cmdline window Problem: Crash when switching tabpage while in the cmdline window. Solution: Disallow switching tabpage when in the cmdline window. --- src/evalvars.c | 14 ++------------ src/proto/window.pro | 1 + src/usercmd.c | 24 ++++-------------------- src/version.c | 2 ++ src/window.c | 26 ++++++++++++++++++++++++++ 5 files changed, 35 insertions(+), 32 deletions(-) Backport: Since the old version dosn't do command line completion correctly, those parts are dropped and we only forbid switching the tab page. diff --git a/src/version.c b/src/version.c index c5f5c22f90ac..777476d80dce 100644 --- a/src/version.c +++ b/src/version.c @@ -795,6 +795,8 @@ static char *(features[]) = 805, /**/ 5024, +/**/ + 4428, /**/ 4397, /**/ diff --git a/src/window.c b/src/window.c index 1f5e7096047c..b00ed977fc04 100644 --- a/src/window.c +++ b/src/window.c @@ -3656,6 +3656,14 @@ win_new_tabpage(int after) tabpage_T *newtp; int n; +#ifdef FEAT_CMDWIN + if (cmdwin_type != 0) + { + emsg(_("E11: Invalid in command-line window; :q closes the window")); + return FAIL; + } +#endif + newtp = alloc_tabpage(); if (newtp == NULL) return FAIL; @@ -3997,6 +4005,7 @@ goto_tabpage(int n) text_locked_msg(); return; } + CHECK_CMDWIN; /* If there is only one it can't work. */ if (first_tabpage->tp_next == NULL) @@ -4064,6 +4073,8 @@ goto_tabpage_tp( int trigger_enter_autocmds, int trigger_leave_autocmds) { + CHECK_CMDWIN; + /* Don't repeat a message in another tab page. */ set_keep_msg(NULL, 0);