Patch 8.2.1748
Problem:    Closing split window in other tab may cause a crash.
Solution:   Set tp_curwin properly. (Rob Pilling, closes #7018)
Files:      src/window.c, src/testdir/test_winbuf_close.vim


*** ../vim-8.2.1747/src/window.c        2020-08-10 19:21:12.163749066 +0200
--- src/window.c        2020-09-26 19:10:28.057567344 +0200
***************
*** 2745,2750 ****
--- 2745,2751 ----
  {
      frame_T   *frp;
      win_T     *wp;
+     tabpage_T *win_tp = tp == NULL ? curtab : tp;
  
      // Remove the window and its frame from the tree of frames.
      frp = win->w_frame;
***************
*** 2752,2761 ****
      vim_free(frp);
      win_free(win, tp);
  
!     // When deleting the current window of another tab page select a new
!     // current window.
!     if (tp != NULL && win == tp->tp_curwin)
!       tp->tp_curwin = wp;
  
      return wp;
  }
--- 2753,2762 ----
      vim_free(frp);
      win_free(win, tp);
  
!     // When deleting the current window in the tab, select a new current
!     // window.
!     if (win == win_tp->tp_curwin)
!       win_tp->tp_curwin = wp;
  
      return wp;
  }
*** ../vim-8.2.1747/src/testdir/test_winbuf_close.vim   2020-09-04 
21:18:40.492161906 +0200
--- src/testdir/test_winbuf_close.vim   2020-09-26 19:07:35.061806350 +0200
***************
*** 192,198 ****
    call win_execute(l:wid, 'close')
    " Should not crash.
    call assert_true(v:true)
!   %bwipe!
  endfunc
  
  " Test when closing a split window (above/below) restores space to the window
--- 192,214 ----
    call win_execute(l:wid, 'close')
    " Should not crash.
    call assert_true(v:true)
! 
!   " This tests closing a window in another tab, while leaving the tab open
!   " i.e. two windows in another tab.
!   tabedit
!   let w:this_win = 42
!   new
!   let othertab_wid = win_getid()
!   tabprevious
!   call win_execute(othertab_wid, 'q')
!   " drawing the tabline helps check that the other tab's windows and buffers
!   " are still valid
!   redrawtabline
!   " but to be certain, ensure we can focus the other tab too
!   tabnext
!   call assert_equal(42, w:this_win)
! 
!   bwipe!
  endfunc
  
  " Test when closing a split window (above/below) restores space to the window
*** ../vim-8.2.1747/src/version.c       2020-09-26 18:47:03.401502472 +0200
--- src/version.c       2020-09-26 19:04:38.678020457 +0200
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     1748,
  /**/

-- 
I think that you'll agree that engineers are very effective in their social
interactions.  It's the "normal" people who are nuts.
                                (Scott Adams - The Dilbert principle)

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202009261712.08QHCHdE817050%40masaka.moolenaar.net.

Raspunde prin e-mail lui