]> granicus.if.org Git - vim/commitdiff
patch 8.2.4438: crash on exit when using cmdline window v8.2.4438
authorBram Moolenaar <Bram@vim.org>
Tue, 22 Feb 2022 12:08:07 +0000 (12:08 +0000)
committerBram Moolenaar <Bram@vim.org>
Tue, 22 Feb 2022 12:08:07 +0000 (12:08 +0000)
Problem:    Crash on exit when using cmdline window.
Solution:   Reset "cmdwin_type" before exiting. (closes #9817)

src/testdir/test_exit.vim
src/ui.c
src/version.c

index 93b8f5171a4a904c4a7d6b0dddc016ee0a635896..b42eebfa856e7020080cd4cc06d101d4e2e70932 100644 (file)
@@ -1,6 +1,7 @@
 " Tests for exiting Vim.
 
 source shared.vim
+source check.vim
 
 func Test_exiting()
   let after =<< trim [CODE]
@@ -109,4 +110,17 @@ func Test_exit_code()
   call delete('Xtestout')
 endfunc
 
+func Test_exit_error_reading_input()
+  CheckNotGui
+
+  call writefile([":au VimLeave * call writefile(['l = ' .. v:exiting], 'Xtestout')", ":tabnew\<CR>q:"], 'Xscript')
+
+  if RunVim([], [], '< Xscript')
+    call assert_equal(['l = 1'], readfile('Xtestout'))
+  endif
+  call delete('Xscript')
+  call delete('Xtestout')
+endfun
+
+
 " vim: shiftwidth=2 sts=2 expandtab
index a6cee804ad47de056543e2f8158c25e833e4602a..bf6ea858b046ba87c065a497c961fa00f4199065 100644 (file)
--- a/src/ui.c
+++ b/src/ui.c
@@ -1065,6 +1065,9 @@ read_error_exit(void)
     if (silent_mode)   // Normal way to exit for "ex -s"
        getout(0);
     STRCPY(IObuff, _("Vim: Error reading input, exiting...\n"));
+#ifdef FEAT_CMDWIN
+    cmdwin_type = 0;
+#endif
     preserve_exit();
 }
 
index 7001029010f216ddc93f92c907a24b5bc05fddbb..399aef93c27763cfc2815fbcfb613068409bd0d8 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    4438,
 /**/
     4437,
 /**/