# HG changeset patch # User Bram Moolenaar # Date 1640036703 -3600 # Node ID bbcbb3c13fba2608dfac23a37a1ed6986106f779 # Parent 5623a07d71043520e115d4e18a899c95295e320e patch 8.2.3862: crash on exit with EXITFREE and using win_execute() Commit: https://github.com/vim/vim/commit/dab17a0689a2f31f69f428975f84b0c3c7ba3030 Author: Bram Moolenaar Date: Mon Dec 20 21:35:59 2021 +0000 patch 8.2.3862: crash on exit with EXITFREE and using win_execute() Problem: Crash on exit with EXITFREE and using win_execute(). Solution: Also save and restore tp_topframe. (issue https://github.com/vim/vim/issues/9374) diff --git a/src/evalwindow.c b/src/evalwindow.c --- a/src/evalwindow.c +++ b/src/evalwindow.c @@ -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); diff --git a/src/testdir/test_execute_func.vim b/src/testdir/test_execute_func.vim --- a/src/testdir/test_execute_func.vim +++ b/src/testdir/test_execute_func.vim @@ -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())) diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -750,6 +750,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 3862, +/**/ 3861, /**/ 3860,