81c2858
To: vim-dev@vim.org
81c2858
Subject: Patch 7.2.240
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.240
81c2858
Problem:    Crash when using find/replace dialog repeatedly. (Michiel
81c2858
	    Hartsuiker)
81c2858
Solution:   Avoid doing the operation while busy or recursively.  Also refuse
81c2858
	    replace when text is locked.
81c2858
Files:	    src/gui.c
81c2858
81c2858
81c2858
*** ../vim-7.2.239/src/gui.c	2009-06-24 18:31:36.000000000 +0200
81c2858
--- src/gui.c	2009-07-22 16:54:16.000000000 +0200
81c2858
***************
81c2858
*** 5004,5009 ****
81c2858
--- 5004,5022 ----
81c2858
      char_u	*p;
81c2858
      regmatch_T	regmatch;
81c2858
      int		save_did_emsg = did_emsg;
81c2858
+     static int  busy = FALSE;
81c2858
+ 
81c2858
+     /* When the screen is being updated we should not change buffers and
81c2858
+      * windows structures, it may cause freed memory to be used.  Also don't
81c2858
+      * do this recursively (pressing "Find" quickly several times. */
81c2858
+     if (updating_screen || busy)
81c2858
+ 	return FALSE;
81c2858
+ 
81c2858
+     /* refuse replace when text cannot be changed */
81c2858
+     if ((type == FRD_REPLACE || type == FRD_REPLACEALL) && text_locked())
81c2858
+ 	return FALSE;
81c2858
+ 
81c2858
+     busy = TRUE;
81c2858
  
81c2858
      ga_init2(&ga, 1, 100);
81c2858
      if (type == FRD_REPLACEALL)
81c2858
***************
81c2858
*** 5094,5099 ****
81c2858
--- 5107,5113 ----
81c2858
      }
81c2858
  
81c2858
      vim_free(ga.ga_data);
81c2858
+     busy = FALSE;
81c2858
      return (ga.ga_len > 0);
81c2858
  }
81c2858
  
81c2858
*** ../vim-7.2.239/src/version.c	2009-07-22 16:22:33.000000000 +0200
81c2858
--- src/version.c	2009-07-29 11:09:13.000000000 +0200
81c2858
***************
81c2858
*** 678,679 ****
81c2858
--- 678,681 ----
81c2858
  {   /* Add new patch number below this line */
81c2858
+ /**/
81c2858
+     240,
81c2858
  /**/
81c2858
81c2858
-- 
81c2858
hundred-and-one symptoms of being an internet addict:
81c2858
113. You are asked about a bus schedule, you wonder if it is 16 or 32 bits.
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    ///