Karsten Hopp 23bda8
To: vim-dev@vim.org
Karsten Hopp 23bda8
Subject: Patch 7.2.305
Karsten Hopp 23bda8
Fcc: outbox
Karsten Hopp 23bda8
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 23bda8
Mime-Version: 1.0
Karsten Hopp 23bda8
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 23bda8
Content-Transfer-Encoding: 8bit
Karsten Hopp 23bda8
------------
Karsten Hopp 23bda8
Karsten Hopp 23bda8
Patch 7.2.305
Karsten Hopp 23bda8
Problem:    Recursively redrawing causes a memory leak. (Dominique Pelle)
Karsten Hopp 23bda8
Solution:   Disallow recursive screen updating.
Karsten Hopp 23bda8
Files:	    src/screen.c
Karsten Hopp 23bda8
Karsten Hopp 23bda8
Karsten Hopp 23bda8
*** ../vim-7.2.304/src/screen.c	2009-11-11 17:07:25.000000000 +0100
Karsten Hopp 23bda8
--- src/screen.c	2009-11-17 16:30:53.000000000 +0100
Karsten Hopp 23bda8
***************
Karsten Hopp 23bda8
*** 323,328 ****
Karsten Hopp 23bda8
--- 323,329 ----
Karsten Hopp 23bda8
      int		did_one;
Karsten Hopp 23bda8
  #endif
Karsten Hopp 23bda8
  
Karsten Hopp 23bda8
+     /* Don't do anything if the screen structures are (not yet) valid. */
Karsten Hopp 23bda8
      if (!screen_valid(TRUE))
Karsten Hopp 23bda8
  	return;
Karsten Hopp 23bda8
  
Karsten Hopp 23bda8
***************
Karsten Hopp 23bda8
*** 342,348 ****
Karsten Hopp 23bda8
      if (curwin->w_lines_valid == 0 && type < NOT_VALID)
Karsten Hopp 23bda8
  	type = NOT_VALID;
Karsten Hopp 23bda8
  
Karsten Hopp 23bda8
!     if (!redrawing())
Karsten Hopp 23bda8
      {
Karsten Hopp 23bda8
  	redraw_later(type);		/* remember type for next time */
Karsten Hopp 23bda8
  	must_redraw = type;
Karsten Hopp 23bda8
--- 343,351 ----
Karsten Hopp 23bda8
      if (curwin->w_lines_valid == 0 && type < NOT_VALID)
Karsten Hopp 23bda8
  	type = NOT_VALID;
Karsten Hopp 23bda8
  
Karsten Hopp 23bda8
!     /* Postpone the redrawing when it's not needed and when being called
Karsten Hopp 23bda8
!      * recursively. */
Karsten Hopp 23bda8
!     if (!redrawing() || updating_screen)
Karsten Hopp 23bda8
      {
Karsten Hopp 23bda8
  	redraw_later(type);		/* remember type for next time */
Karsten Hopp 23bda8
  	must_redraw = type;
Karsten Hopp 23bda8
***************
Karsten Hopp 23bda8
*** 582,587 ****
Karsten Hopp 23bda8
--- 585,591 ----
Karsten Hopp 23bda8
  
Karsten Hopp 23bda8
  /*
Karsten Hopp 23bda8
   * Prepare for updating one or more windows.
Karsten Hopp 23bda8
+  * Caller must check for "updating_screen" already set to avoid recursiveness.
Karsten Hopp 23bda8
   */
Karsten Hopp 23bda8
      static void
Karsten Hopp 23bda8
  update_prepare()
Karsten Hopp 23bda8
***************
Karsten Hopp 23bda8
*** 663,669 ****
Karsten Hopp 23bda8
  	    doit = TRUE;
Karsten Hopp 23bda8
      }
Karsten Hopp 23bda8
  
Karsten Hopp 23bda8
!     if (!doit)
Karsten Hopp 23bda8
  	return;
Karsten Hopp 23bda8
  
Karsten Hopp 23bda8
      /* update all windows that need updating */
Karsten Hopp 23bda8
--- 667,675 ----
Karsten Hopp 23bda8
  	    doit = TRUE;
Karsten Hopp 23bda8
      }
Karsten Hopp 23bda8
  
Karsten Hopp 23bda8
!     /* Return when there is nothing to do or screen updating already
Karsten Hopp 23bda8
!      * happening. */
Karsten Hopp 23bda8
!     if (!doit || updating_screen)
Karsten Hopp 23bda8
  	return;
Karsten Hopp 23bda8
  
Karsten Hopp 23bda8
      /* update all windows that need updating */
Karsten Hopp 23bda8
***************
Karsten Hopp 23bda8
*** 696,701 ****
Karsten Hopp 23bda8
--- 702,711 ----
Karsten Hopp 23bda8
  updateWindow(wp)
Karsten Hopp 23bda8
      win_T	*wp;
Karsten Hopp 23bda8
  {
Karsten Hopp 23bda8
+     /* return if already busy updating */
Karsten Hopp 23bda8
+     if (updating_screen)
Karsten Hopp 23bda8
+ 	return;
Karsten Hopp 23bda8
+ 
Karsten Hopp 23bda8
      update_prepare();
Karsten Hopp 23bda8
  
Karsten Hopp 23bda8
  #ifdef FEAT_CLIPBOARD
Karsten Hopp 23bda8
*** ../vim-7.2.304/src/version.c	2009-11-25 12:38:49.000000000 +0100
Karsten Hopp 23bda8
--- src/version.c	2009-11-25 13:01:48.000000000 +0100
Karsten Hopp 23bda8
***************
Karsten Hopp 23bda8
*** 683,684 ****
Karsten Hopp 23bda8
--- 683,686 ----
Karsten Hopp 23bda8
  {   /* Add new patch number below this line */
Karsten Hopp 23bda8
+ /**/
Karsten Hopp 23bda8
+     305,
Karsten Hopp 23bda8
  /**/
Karsten Hopp 23bda8
Karsten Hopp 23bda8
-- 
Karsten Hopp 23bda8
If the Universe is constantly expanding, why can't I ever find a parking space?
Karsten Hopp 23bda8
Karsten Hopp 23bda8
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 23bda8
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 23bda8
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp 23bda8
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///