components/vim/vim72-patches/7.2.122
changeset 379 c6a17bba1da3
parent 378 f0b61ed1d10d
child 380 e92b3b4a1c66
equal deleted inserted replaced
378:f0b61ed1d10d 379:c6a17bba1da3
     1 To: [email protected]
       
     2 Subject: Patch 7.2.122
       
     3 Fcc: outbox
       
     4 From: Bram Moolenaar <[email protected]>
       
     5 Mime-Version: 1.0
       
     6 Content-Type: text/plain; charset=ISO-8859-1
       
     7 Content-Transfer-Encoding: 8bit
       
     8 ------------
       
     9 
       
    10 Patch 7.2.122
       
    11 Problem:    Invalid memory access when the VimResized autocommand changes
       
    12             'columns' and/or 'lines'.
       
    13 Solution:   After VimResized check for changed values. (Dominique Pelle)
       
    14 Files:      src/screen.c
       
    15 
       
    16 
       
    17 *** ../vim-7.2.121/src/screen.c	Sun Feb 22 01:13:45 2009
       
    18 --- src/screen.c	Sun Feb 22 01:07:38 2009
       
    19 ***************
       
    20 *** 7368,7374 ****
       
    21 --- 7368,7378 ----
       
    22   #endif
       
    23       static int	    entered = FALSE;		/* avoid recursiveness */
       
    24       static int	    done_outofmem_msg = FALSE;	/* did outofmem message */
       
    25 + #ifdef FEAT_AUTOCMD
       
    26 +     int		    retry_count = 0;
       
    27   
       
    28 + retry:
       
    29 + #endif
       
    30       /*
       
    31        * Allocation of the screen buffers is done only when the size changes and
       
    32        * when Rows and Columns have been set and we have started doing full
       
    33 ***************
       
    34 *** 7643,7650 ****
       
    35       --RedrawingDisabled;
       
    36   
       
    37   #ifdef FEAT_AUTOCMD
       
    38 !     if (starting == 0)
       
    39   	apply_autocmds(EVENT_VIMRESIZED, NULL, NULL, FALSE, curbuf);
       
    40   #endif
       
    41   }
       
    42   
       
    43 --- 7647,7663 ----
       
    44       --RedrawingDisabled;
       
    45   
       
    46   #ifdef FEAT_AUTOCMD
       
    47 !     /*
       
    48 !      * Do not apply autocommands more than 3 times to avoid an endless loop
       
    49 !      * in case applying autocommands always changes Rows or Columns.
       
    50 !      */
       
    51 !     if (starting == 0 && ++retry_count <= 3)
       
    52 !     {
       
    53   	apply_autocmds(EVENT_VIMRESIZED, NULL, NULL, FALSE, curbuf);
       
    54 + 	/* In rare cases, autocommands may have altered Rows or Columns,
       
    55 + 	 * jump back to check if we need to allocate the screen again. */
       
    56 + 	goto retry;
       
    57 +     }
       
    58   #endif
       
    59   }
       
    60   
       
    61 *** ../vim-7.2.121/src/version.c	Sun Feb 22 02:51:37 2009
       
    62 --- src/version.c	Sun Feb 22 21:11:14 2009
       
    63 ***************
       
    64 *** 678,679 ****
       
    65 --- 678,681 ----
       
    66   {   /* Add new patch number below this line */
       
    67 + /**/
       
    68 +     122,
       
    69   /**/
       
    70 
       
    71 -- 
       
    72 FIXME and XXX are two common keywords used to mark broken or incomplete code
       
    73 not only since XXX as a sex reference would grab everbodys attention but
       
    74 simply due to the fact that Vim would highlight these words.
       
    75 					-- Hendrik Scholz
       
    76 
       
    77  /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
       
    78 ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
       
    79 \\\        download, build and distribute -- http://www.A-A-P.org        ///
       
    80  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///