Patch 8.2.1638
Problem:    Leaking memory when popup filter function can't be called.
Solution:   Don't return too soon.
Files:      src/popupwin.c


*** ../vim-8.2.1637/src/popupwin.c      2020-09-08 22:06:12.825040939 +0200
--- src/popupwin.c      2020-09-08 22:53:50.303866114 +0200
***************
*** 3155,3185 ****
      if (call_callback(&wp->w_filter_cb, -1, &rettv, 2, argv) == FAIL)
      {
        // Cannot call the function, close the popup to avoid that the filter
!       // eats keys and the user can't get out.
        popup_close_with_retval(wp, -1);
!       return 1;
!     }
! 
!     if (win_valid_popup(wp) && old_lnum != wp->w_cursor.lnum)
!       popup_highlight_curline(wp);
! 
!     // If an error was given always return FALSE, so that keys are not
!     // consumed and the user can type something.
!     // If we get three errors in a row then close the popup.  Decrement the
!     // error count by 1/10 if there are no errors, thus allowing up to 1 in
!     // 10 calls to cause an error.
!     if (win_valid_popup(wp) && called_emsg > prev_called_emsg)
!     {
!       wp->w_filter_errors += 10;
!       if (wp->w_filter_errors >= 30)
!           popup_close_with_retval(wp, -1);
!       res = FALSE;
      }
      else
      {
!       if (win_valid_popup(wp) && wp->w_filter_errors > 0)
!           --wp->w_filter_errors;
!       res = tv_get_bool(&rettv);
      }
  
      vim_free(argv[1].vval.v_string);
--- 3155,3187 ----
      if (call_callback(&wp->w_filter_cb, -1, &rettv, 2, argv) == FAIL)
      {
        // Cannot call the function, close the popup to avoid that the filter
!       // eats keys and the user is stuck.  Might as well eat the key.
        popup_close_with_retval(wp, -1);
!       res = TRUE;
      }
      else
      {
!       if (win_valid_popup(wp) && old_lnum != wp->w_cursor.lnum)
!           popup_highlight_curline(wp);
! 
!       // If an error was given always return FALSE, so that keys are not
!       // consumed and the user can type something.
!       // If we get three errors in a row then close the popup.  Decrement the
!       // error count by 1/10 if there are no errors, thus allowing up to 1 in
!       // 10 calls to cause an error.
!       if (win_valid_popup(wp) && called_emsg > prev_called_emsg)
!       {
!           wp->w_filter_errors += 10;
!           if (wp->w_filter_errors >= 30)
!               popup_close_with_retval(wp, -1);
!           res = FALSE;
!       }
!       else
!       {
!           if (win_valid_popup(wp) && wp->w_filter_errors > 0)
!               --wp->w_filter_errors;
!           res = tv_get_bool(&rettv);
!       }
      }
  
      vim_free(argv[1].vval.v_string);
*** ../vim-8.2.1637/src/version.c       2020-09-08 22:45:31.113504961 +0200
--- src/version.c       2020-09-08 22:55:05.083670702 +0200
***************
*** 756,757 ****
--- 756,759 ----
  {   /* Add new patch number below this line */
+ /**/
+     1638,
  /**/

-- 
ARTHUR: Charge!
   [They all charge with swords drawn towards the RABBIT.  A tremendous twenty
   second fight with Peckinpahish shots and borrowing heavily also on the
   Kung Fu and karate-type films ensues, in which some four KNIGHTS are
   comprehensively killed.]
ARTHUR: Run away!  Run away!
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// 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/202009082057.088KvHD0152367%40masaka.moolenaar.net.

Raspunde prin e-mail lui