]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.2.3862: crash on exit with EXITFREE and using win_execute() v8.2.3862
authorBram Moolenaar <Bram@vim.org>
Mon, 20 Dec 2021 21:35:59 +0000 (21:35 +0000)
committerBram Moolenaar <Bram@vim.org>
Mon, 20 Dec 2021 21:35:59 +0000 (21:35 +0000)
Problem:    Crash on exit with EXITFREE and using win_execute().
Solution:   Also save and restore tp_topframe. (issue #9374)

src/evalwindow.c
src/testdir/test_execute_func.vim
src/version.c

index c8c1442d2713360f2ed42431f4f43a8c1a94c33d..794d6aa0bb2a6a976cb3aea616a69dd8409ecc04 100644 (file)
@@ -1250,9 +1250,11 @@ switch_win_noblock(
        {
            curtab->tp_firstwin = firstwin;
            curtab->tp_lastwin = lastwin;
+           curtab->tp_topframe = topframe;
            curtab = tp;
            firstwin = curtab->tp_firstwin;
            lastwin = curtab->tp_lastwin;
+           topframe = curtab->tp_topframe;
        }
        else
            goto_tabpage_tp(tp, FALSE, FALSE);
@@ -1294,9 +1296,11 @@ restore_win_noblock(
        {
            curtab->tp_firstwin = firstwin;
            curtab->tp_lastwin = lastwin;
+           curtab->tp_topframe = topframe;
            curtab = save_curtab;
            firstwin = curtab->tp_firstwin;
            lastwin = curtab->tp_lastwin;
+           topframe = curtab->tp_topframe;
        }
        else
            goto_tabpage_tp(save_curtab, FALSE, FALSE);
index 06049c272a505c832bac93116624f0800a010f83..9146504e5e27611212f89c6d8c4b24a341ebc07d 100644 (file)
@@ -3,6 +3,7 @@
 source view_util.vim
 source check.vim
 source vim9.vim
+source term_util.vim
 
 func NestedEval()
   let nested = execute('echo "nested\nlines"')
@@ -148,6 +149,27 @@ func Test_win_execute_other_tab()
   unlet xyz
 endfunc
 
+func Test_win_execute_on_startup()
+  CheckRunVimInTerminal
+
+  let lines =<< trim END
+      vim9script
+      [repeat('x', &columns)]->writefile('Xfile1')
+      silent tabedit Xfile2
+      var id = win_getid()
+      silent tabedit Xfile3
+      autocmd VimEnter * win_execute(id, 'close')
+  END
+  call writefile(lines, 'XwinExecute')
+  let buf = RunVimInTerminal('-p Xfile1 -Nu XwinExecute', {})
+
+  " this was crashing on exit with EXITFREE defined
+  call StopVimInTerminal(buf)
+
+  call delete('XwinExecute')
+  call delete('Xfile1')
+endfunc
+
 func Test_execute_func_with_null()
   call assert_equal("", execute(test_null_string()))
   call assert_equal("", execute(test_null_list()))
index 022c161ad18299cf629b41bcf55be74c41cb5344..bca93823184d5169621ef7fcbbcd0ce64fe2a20c 100644 (file)
@@ -749,6 +749,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3862,
 /**/
     3861,
 /**/