components/vim/vim72-patches/7.2.332
author Danek Duvall <danek.duvall@oracle.com>
Thu, 07 Apr 2011 16:25:07 -0700
changeset 198 172fc01ce997
permissions -rw-r--r--
7016732 move vim from sfw to userland 7036367 vim is too big

To: [email protected]
Subject: Patch 7.2.332
Fcc: outbox
From: Bram Moolenaar <[email protected]>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 7.2.332
Problem:    Crash when spell correcting triggers an autocommand that reloads
	    the buffer.
Solution:   Make a copy of the line to be modified. (Dominique Pelle)
Files:	    src/spell.c


*** ../vim-7.2.331/src/spell.c	2009-07-22 11:03:38.000000000 +0200
--- src/spell.c	2010-01-19 12:44:42.000000000 +0100
***************
*** 10306,10312 ****
      /* Figure out if the word should be capitalised. */
      need_cap = check_need_cap(curwin->w_cursor.lnum, curwin->w_cursor.col);
  
!     line = ml_get_curline();
  
      /* Get the list of suggestions.  Limit to 'lines' - 2 or the number in
       * 'spellsuggest', whatever is smaller. */
--- 10306,10315 ----
      /* Figure out if the word should be capitalised. */
      need_cap = check_need_cap(curwin->w_cursor.lnum, curwin->w_cursor.col);
  
!     /* Make a copy of current line since autocommands may free the line. */
!     line = vim_strsave(ml_get_curline());
!     if (line == NULL)
! 	goto skip;
  
      /* Get the list of suggestions.  Limit to 'lines' - 2 or the number in
       * 'spellsuggest', whatever is smaller. */
***************
*** 10470,10475 ****
--- 10473,10480 ----
  	curwin->w_cursor = prev_cursor;
  
      spell_find_cleanup(&sug);
+ skip:
+     vim_free(line);
  }
  
  /*
***************
*** 10931,10937 ****
  	    rescore_suggestions(su);
  
  	/*
! 	 * While going throught the soundfold tree "su_maxscore" is the score
  	 * for the soundfold word, limits the changes that are being tried,
  	 * and "su_sfmaxscore" the rescored score, which is set by
  	 * cleanup_suggestions().
--- 10936,10942 ----
  	    rescore_suggestions(su);
  
  	/*
! 	 * While going through the soundfold tree "su_maxscore" is the score
  	 * for the soundfold word, limits the changes that are being tried,
  	 * and "su_sfmaxscore" the rescored score, which is set by
  	 * cleanup_suggestions().
***************
*** 11415,11421 ****
      char_u	tword[MAXWLEN];	    /* good word collected so far */
      trystate_T	stack[MAXWLEN];
      char_u	preword[MAXWLEN * 3]; /* word found with proper case;
! 				       * concatanation of prefix compound
  				       * words and split word.  NUL terminated
  				       * when going deeper but not when coming
  				       * back. */
--- 11420,11426 ----
      char_u	tword[MAXWLEN];	    /* good word collected so far */
      trystate_T	stack[MAXWLEN];
      char_u	preword[MAXWLEN * 3]; /* word found with proper case;
! 				       * concatenation of prefix compound
  				       * words and split word.  NUL terminated
  				       * when going deeper but not when coming
  				       * back. */
*** ../vim-7.2.331/src/version.c	2010-01-19 12:46:51.000000000 +0100
--- src/version.c	2010-01-19 13:05:32.000000000 +0100
***************
*** 683,684 ****
--- 683,686 ----
  {   /* Add new patch number below this line */
+ /**/
+     332,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
117. You are more comfortable typing in html.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///