Patch 8.2.1985
Problem:    Crash when closing terminal popup with <Cmd> mapping.
Solution:   Check b_term is not NULL. (closes #7294)
Files:      src/terminal.c, src/testdir/test_terminal.vim


*** ../vim-8.2.1984/src/terminal.c      2020-11-12 15:12:12.034017200 +0100
--- src/terminal.c      2020-11-14 20:18:30.038140781 +0100
***************
*** 2527,2533 ****
      while (blocking || vpeekc_nomap() != NUL)
      {
  #ifdef FEAT_GUI
!       if (!curbuf->b_term->tl_system)
  #endif
            // TODO: skip screen update when handling a sequence of keys.
            // Repeat redrawing in case a message is received while redrawing.
--- 2527,2533 ----
      while (blocking || vpeekc_nomap() != NUL)
      {
  #ifdef FEAT_GUI
!       if (curbuf->b_term != NULL && !curbuf->b_term->tl_system)
  #endif
            // TODO: skip screen update when handling a sequence of keys.
            // Repeat redrawing in case a message is received while redrawing.
***************
*** 2542,2549 ****
        restore_cursor = TRUE;
  
        raw_c = term_vgetc();
- if (raw_c > 0)
-     ch_log(NULL, "terminal_loop() got %d", raw_c);
        if (!term_use_loop_check(TRUE) || in_terminal_loop != curbuf->b_term)
        {
            // Job finished while waiting for a character.  Push back the
--- 2542,2547 ----
*** ../vim-8.2.1984/src/testdir/test_terminal.vim       2020-11-14 
14:21:59.518406461 +0100
--- src/testdir/test_terminal.vim       2020-11-14 20:20:48.097858132 +0100
***************
*** 1225,1230 ****
--- 1225,1242 ----
    call delete('Xopenterm')
  endfunc
  
+ func Test_terminal_popup_with_cmd()
+   " this was crashing
+   let buf = term_start(&shell, #{hidden: v:true})
+   let s:winid = popup_create(buf, {})
+   tnoremap <F3> <Cmd>call popup_close(s:winid)<CR>
+   call feedkeys("\<F3>", 'xt')
+ 
+   tunmap  <F3>
+   exe 'bwipe! ' .. buf
+   unlet s:winid
+ endfunc
+ 
  func Check_dump01(off)
    call assert_equal('one two three four five', trim(getline(a:off + 1)))
    call assert_equal('~           Select Word', trim(getline(a:off + 7)))
*** ../vim-8.2.1984/src/version.c       2020-11-14 17:25:44.868329693 +0100
--- src/version.c       2020-11-14 20:16:58.042319986 +0100
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     1985,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
244. You use more than 20 passwords.

 /// 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/202011141922.0AEJMMsQ681412%40masaka.moolenaar.net.

Raspunde prin e-mail lui