81c2858
To: vim-dev@vim.org
81c2858
Subject: Patch 7.2.224
81c2858
Fcc: outbox
81c2858
From: Bram Moolenaar <Bram@moolenaar.net>
81c2858
Mime-Version: 1.0
81c2858
Content-Type: text/plain; charset=UTF-8
81c2858
Content-Transfer-Encoding: 8bit
81c2858
------------
81c2858
81c2858
Patch 7.2.224
81c2858
Problem:    Crash when using 'completefunc'. (Ingo Karkat)
81c2858
Solution:   Disallow entering edit() recursively when doing completion.
81c2858
Files:	    src/edit.c
81c2858
81c2858
81c2858
*** ../vim-7.2.223/src/edit.c	2009-05-26 11:01:43.000000000 +0200
81c2858
--- src/edit.c	2009-07-09 18:01:49.000000000 +0200
81c2858
***************
81c2858
*** 114,119 ****
81c2858
--- 114,123 ----
81c2858
   * FALSE the word to be completed must be located. */
81c2858
  static int	  compl_started = FALSE;
81c2858
  
81c2858
+ /* Set when doing something for completion that may call edit() recursively,
81c2858
+  * which is not allowed. */
81c2858
+ static int	  compl_busy = FALSE;
81c2858
+ 
81c2858
  static int	  compl_matches = 0;
81c2858
  static char_u	  *compl_pattern = NULL;
81c2858
  static int	  compl_direction = FORWARD;
81c2858
***************
81c2858
*** 346,352 ****
81c2858
  
81c2858
  #ifdef FEAT_INS_EXPAND
81c2858
      /* Don't allow recursive insert mode when busy with completion. */
81c2858
!     if (compl_started || pum_visible())
81c2858
      {
81c2858
  	EMSG(_(e_secure));
81c2858
  	return FALSE;
81c2858
--- 350,356 ----
81c2858
  
81c2858
  #ifdef FEAT_INS_EXPAND
81c2858
      /* Don't allow recursive insert mode when busy with completion. */
81c2858
!     if (compl_started || compl_busy || pum_visible())
81c2858
      {
81c2858
  	EMSG(_(e_secure));
81c2858
  	return FALSE;
81c2858
***************
81c2858
*** 1340,1347 ****
81c2858
--- 1344,1353 ----
81c2858
  		goto normalchar;
81c2858
  
81c2858
  docomplete:
81c2858
+ 	    compl_busy = TRUE;
81c2858
  	    if (ins_complete(c) == FAIL)
81c2858
  		compl_cont_status = 0;
81c2858
+ 	    compl_busy = FALSE;
81c2858
  	    break;
81c2858
  #endif /* FEAT_INS_EXPAND */
81c2858
  
81c2858
***************
81c2858
*** 3172,3177 ****
81c2858
--- 3178,3184 ----
81c2858
  	vim_free(match);
81c2858
      } while (compl_curr_match != NULL && compl_curr_match != compl_first_match);
81c2858
      compl_first_match = compl_curr_match = NULL;
81c2858
+     compl_shown_match = NULL;
81c2858
  }
81c2858
  
81c2858
      static void
81c2858
*** ../vim-7.2.223/src/version.c	2009-07-09 15:55:34.000000000 +0200
81c2858
--- src/version.c	2009-07-09 18:14:16.000000000 +0200
81c2858
***************
81c2858
*** 678,679 ****
81c2858
--- 678,681 ----
81c2858
  {   /* Add new patch number below this line */
81c2858
+ /**/
81c2858
+     224,
81c2858
  /**/
81c2858
81c2858
-- 
81c2858
hundred-and-one symptoms of being an internet addict:
81c2858
77. The phone company asks you to test drive their new PBX system
81c2858
81c2858
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
81c2858
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
81c2858
\\\        download, build and distribute -- http://www.A-A-P.org        ///
81c2858
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///