Karsten Hopp dec521
To: vim-dev@vim.org
Karsten Hopp dec521
Subject: Patch 7.2.122
Karsten Hopp dec521
Fcc: outbox
Karsten Hopp dec521
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp dec521
Mime-Version: 1.0
Karsten Hopp dec521
Content-Type: text/plain; charset=ISO-8859-1
Karsten Hopp dec521
Content-Transfer-Encoding: 8bit
Karsten Hopp dec521
------------
Karsten Hopp dec521
Karsten Hopp dec521
Patch 7.2.122
Karsten Hopp dec521
Problem:    Invalid memory access when the VimResized autocommand changes
Karsten Hopp dec521
            'columns' and/or 'lines'.
Karsten Hopp dec521
Solution:   After VimResized check for changed values. (Dominique Pelle)
Karsten Hopp dec521
Files:      src/screen.c
Karsten Hopp dec521
Karsten Hopp dec521
Karsten Hopp dec521
*** ../vim-7.2.121/src/screen.c	Sun Feb 22 01:13:45 2009
Karsten Hopp dec521
--- src/screen.c	Sun Feb 22 01:07:38 2009
Karsten Hopp dec521
***************
Karsten Hopp dec521
*** 7368,7374 ****
Karsten Hopp dec521
--- 7368,7378 ----
Karsten Hopp dec521
  #endif
Karsten Hopp dec521
      static int	    entered = FALSE;		/* avoid recursiveness */
Karsten Hopp dec521
      static int	    done_outofmem_msg = FALSE;	/* did outofmem message */
Karsten Hopp dec521
+ #ifdef FEAT_AUTOCMD
Karsten Hopp dec521
+     int		    retry_count = 0;
Karsten Hopp dec521
  
Karsten Hopp dec521
+ retry:
Karsten Hopp dec521
+ #endif
Karsten Hopp dec521
      /*
Karsten Hopp dec521
       * Allocation of the screen buffers is done only when the size changes and
Karsten Hopp dec521
       * when Rows and Columns have been set and we have started doing full
Karsten Hopp dec521
***************
Karsten Hopp dec521
*** 7643,7650 ****
Karsten Hopp dec521
      --RedrawingDisabled;
Karsten Hopp dec521
  
Karsten Hopp dec521
  #ifdef FEAT_AUTOCMD
Karsten Hopp dec521
!     if (starting == 0)
Karsten Hopp dec521
  	apply_autocmds(EVENT_VIMRESIZED, NULL, NULL, FALSE, curbuf);
Karsten Hopp dec521
  #endif
Karsten Hopp dec521
  }
Karsten Hopp dec521
  
Karsten Hopp dec521
--- 7647,7663 ----
Karsten Hopp dec521
      --RedrawingDisabled;
Karsten Hopp dec521
  
Karsten Hopp dec521
  #ifdef FEAT_AUTOCMD
Karsten Hopp dec521
!     /*
Karsten Hopp dec521
!      * Do not apply autocommands more than 3 times to avoid an endless loop
Karsten Hopp dec521
!      * in case applying autocommands always changes Rows or Columns.
Karsten Hopp dec521
!      */
Karsten Hopp dec521
!     if (starting == 0 && ++retry_count <= 3)
Karsten Hopp dec521
!     {
Karsten Hopp dec521
  	apply_autocmds(EVENT_VIMRESIZED, NULL, NULL, FALSE, curbuf);
Karsten Hopp dec521
+ 	/* In rare cases, autocommands may have altered Rows or Columns,
Karsten Hopp dec521
+ 	 * jump back to check if we need to allocate the screen again. */
Karsten Hopp dec521
+ 	goto retry;
Karsten Hopp dec521
+     }
Karsten Hopp dec521
  #endif
Karsten Hopp dec521
  }
Karsten Hopp dec521
  
Karsten Hopp dec521
*** ../vim-7.2.121/src/version.c	Sun Feb 22 02:51:37 2009
Karsten Hopp dec521
--- src/version.c	Sun Feb 22 21:11:14 2009
Karsten Hopp dec521
***************
Karsten Hopp dec521
*** 678,679 ****
Karsten Hopp dec521
--- 678,681 ----
Karsten Hopp dec521
  {   /* Add new patch number below this line */
Karsten Hopp dec521
+ /**/
Karsten Hopp dec521
+     122,
Karsten Hopp dec521
  /**/
Karsten Hopp dec521
Karsten Hopp dec521
-- 
Karsten Hopp dec521
FIXME and XXX are two common keywords used to mark broken or incomplete code
Karsten Hopp dec521
not only since XXX as a sex reference would grab everbodys attention but
Karsten Hopp dec521
simply due to the fact that Vim would highlight these words.
Karsten Hopp dec521
					-- Hendrik Scholz
Karsten Hopp dec521
Karsten Hopp dec521
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp dec521
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp dec521
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp dec521
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///