Karsten Hopp 81c285
To: vim-dev@vim.org
Karsten Hopp 81c285
Subject: Patch 7.2.240
Karsten Hopp 81c285
Fcc: outbox
Karsten Hopp 81c285
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 81c285
Mime-Version: 1.0
Karsten Hopp 81c285
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 81c285
Content-Transfer-Encoding: 8bit
Karsten Hopp 81c285
------------
Karsten Hopp 81c285
Karsten Hopp 81c285
Patch 7.2.240
Karsten Hopp 81c285
Problem:    Crash when using find/replace dialog repeatedly. (Michiel
Karsten Hopp 81c285
	    Hartsuiker)
Karsten Hopp 81c285
Solution:   Avoid doing the operation while busy or recursively.  Also refuse
Karsten Hopp 81c285
	    replace when text is locked.
Karsten Hopp 81c285
Files:	    src/gui.c
Karsten Hopp 81c285
Karsten Hopp 81c285
Karsten Hopp 81c285
*** ../vim-7.2.239/src/gui.c	2009-06-24 18:31:36.000000000 +0200
Karsten Hopp 81c285
--- src/gui.c	2009-07-22 16:54:16.000000000 +0200
Karsten Hopp 81c285
***************
Karsten Hopp 81c285
*** 5004,5009 ****
Karsten Hopp 81c285
--- 5004,5022 ----
Karsten Hopp 81c285
      char_u	*p;
Karsten Hopp 81c285
      regmatch_T	regmatch;
Karsten Hopp 81c285
      int		save_did_emsg = did_emsg;
Karsten Hopp 81c285
+     static int  busy = FALSE;
Karsten Hopp 81c285
+ 
Karsten Hopp 81c285
+     /* When the screen is being updated we should not change buffers and
Karsten Hopp 81c285
+      * windows structures, it may cause freed memory to be used.  Also don't
Karsten Hopp 81c285
+      * do this recursively (pressing "Find" quickly several times. */
Karsten Hopp 81c285
+     if (updating_screen || busy)
Karsten Hopp 81c285
+ 	return FALSE;
Karsten Hopp 81c285
+ 
Karsten Hopp 81c285
+     /* refuse replace when text cannot be changed */
Karsten Hopp 81c285
+     if ((type == FRD_REPLACE || type == FRD_REPLACEALL) && text_locked())
Karsten Hopp 81c285
+ 	return FALSE;
Karsten Hopp 81c285
+ 
Karsten Hopp 81c285
+     busy = TRUE;
Karsten Hopp 81c285
  
Karsten Hopp 81c285
      ga_init2(&ga, 1, 100);
Karsten Hopp 81c285
      if (type == FRD_REPLACEALL)
Karsten Hopp 81c285
***************
Karsten Hopp 81c285
*** 5094,5099 ****
Karsten Hopp 81c285
--- 5107,5113 ----
Karsten Hopp 81c285
      }
Karsten Hopp 81c285
  
Karsten Hopp 81c285
      vim_free(ga.ga_data);
Karsten Hopp 81c285
+     busy = FALSE;
Karsten Hopp 81c285
      return (ga.ga_len > 0);
Karsten Hopp 81c285
  }
Karsten Hopp 81c285
  
Karsten Hopp 81c285
*** ../vim-7.2.239/src/version.c	2009-07-22 16:22:33.000000000 +0200
Karsten Hopp 81c285
--- src/version.c	2009-07-29 11:09:13.000000000 +0200
Karsten Hopp 81c285
***************
Karsten Hopp 81c285
*** 678,679 ****
Karsten Hopp 81c285
--- 678,681 ----
Karsten Hopp 81c285
  {   /* Add new patch number below this line */
Karsten Hopp 81c285
+ /**/
Karsten Hopp 81c285
+     240,
Karsten Hopp 81c285
  /**/
Karsten Hopp 81c285
Karsten Hopp 81c285
-- 
Karsten Hopp 81c285
hundred-and-one symptoms of being an internet addict:
Karsten Hopp 81c285
113. You are asked about a bus schedule, you wonder if it is 16 or 32 bits.
Karsten Hopp 81c285
Karsten Hopp 81c285
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 81c285
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 81c285
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp 81c285
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///