Patch 8.2.0327
Problem:    Crash when opening and closing two popup terminal windows.
Solution:   Check that prevwin is valid. (closes #5707)
Files:      src/popupwin.c, src/testdir/test_terminal.vim


*** ../vim-8.2.0326/src/popupwin.c      2020-02-20 20:11:50.358377694 +0100
--- src/popupwin.c      2020-02-28 19:08:45.782659906 +0100
***************
*** 2114,2122 ****
  #ifdef FEAT_TERMINAL
      if (wp == curwin && curbuf->b_term != NULL)
      {
!       // Closing popup window with a terminal: put focus back on the previous
!       // window.
!       win_enter(prevwin, FALSE);
      }
  #endif
  
--- 2114,2144 ----
  #ifdef FEAT_TERMINAL
      if (wp == curwin && curbuf->b_term != NULL)
      {
!       win_T *owp;
! 
!       // Closing popup window with a terminal: put focus back on the first
!       // that works:
!       // - another popup window with a terminal
!       // - the previous window
!       // - the first one.
!       for (owp = first_popupwin; owp != NULL; owp = owp->w_next)
!           if (owp != curwin && owp->w_buffer->b_term != NULL)
!               break;
!       if (owp != NULL)
!           win_enter(owp, FALSE);
!       else
!       {
!           for (owp = curtab->tp_first_popupwin; owp != NULL;
!                                                            owp = owp->w_next)
!               if (owp != curwin && owp->w_buffer->b_term != NULL)
!                   break;
!           if (owp != NULL)
!               win_enter(owp, FALSE);
!           else if (win_valid(prevwin))
!               win_enter(prevwin, FALSE);
!           else
!               win_enter(firstwin, FALSE);
!       }
      }
  #endif
  
*** ../vim-8.2.0326/src/testdir/test_terminal.vim       2020-02-24 
21:37:50.950593397 +0100
--- src/testdir/test_terminal.vim       2020-02-28 18:49:40.254037568 +0100
***************
*** 2391,2396 ****
--- 2391,2407 ----
    call delete('XtermPopup')
  endfunc
  
+ func Test_double_popup_terminal()
+   let buf1 = term_start(&shell, #{hidden: 1})
+   let win1 = popup_create(buf1, {})
+   let buf2 = term_start(&shell, #{hidden: 1})
+   let win2 = popup_create(buf2, {})
+   call popup_close(win1)
+   call popup_close(win2)
+   exe buf1 .. 'bwipe!'
+   exe buf2 .. 'bwipe!'
+ endfunc
+ 
  func Test_issue_5607()
    let wincount = winnr('$')
    exe 'terminal' &shell &shellcmdflag 'exit'
*** ../vim-8.2.0326/src/version.c       2020-02-27 21:48:46.634738617 +0100
--- src/version.c       2020-02-28 18:35:35.256846123 +0100
***************
*** 740,741 ****
--- 740,743 ----
  {   /* Add new patch number below this line */
+ /**/
+     327,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
129. You cancel your newspaper subscription.

 /// 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/202002281812.01SICLHA030566%40masaka.moolenaar.net.

Raspunde prin e-mail lui