1051272
To: vim-dev@vim.org
1051272
Subject: Patch 7.2.332
1051272
Fcc: outbox
1051272
From: Bram Moolenaar <Bram@moolenaar.net>
1051272
Mime-Version: 1.0
1051272
Content-Type: text/plain; charset=UTF-8
1051272
Content-Transfer-Encoding: 8bit
1051272
------------
1051272
1051272
Patch 7.2.332
1051272
Problem:    Crash when spell correcting triggers an autocommand that reloads
1051272
	    the buffer.
1051272
Solution:   Make a copy of the line to be modified. (Dominique Pelle)
1051272
Files:	    src/spell.c
1051272
1051272
1051272
*** ../vim-7.2.331/src/spell.c	2009-07-22 11:03:38.000000000 +0200
1051272
--- src/spell.c	2010-01-19 12:44:42.000000000 +0100
1051272
***************
1051272
*** 10306,10312 ****
1051272
      /* Figure out if the word should be capitalised. */
1051272
      need_cap = check_need_cap(curwin->w_cursor.lnum, curwin->w_cursor.col);
1051272
  
1051272
!     line = ml_get_curline();
1051272
  
1051272
      /* Get the list of suggestions.  Limit to 'lines' - 2 or the number in
1051272
       * 'spellsuggest', whatever is smaller. */
1051272
--- 10306,10315 ----
1051272
      /* Figure out if the word should be capitalised. */
1051272
      need_cap = check_need_cap(curwin->w_cursor.lnum, curwin->w_cursor.col);
1051272
  
1051272
!     /* Make a copy of current line since autocommands may free the line. */
1051272
!     line = vim_strsave(ml_get_curline());
1051272
!     if (line == NULL)
1051272
! 	goto skip;
1051272
  
1051272
      /* Get the list of suggestions.  Limit to 'lines' - 2 or the number in
1051272
       * 'spellsuggest', whatever is smaller. */
1051272
***************
1051272
*** 10470,10475 ****
1051272
--- 10473,10480 ----
1051272
  	curwin->w_cursor = prev_cursor;
1051272
  
1051272
      spell_find_cleanup(&sug;;
1051272
+ skip:
1051272
+     vim_free(line);
1051272
  }
1051272
  
1051272
  /*
1051272
***************
1051272
*** 10931,10937 ****
1051272
  	    rescore_suggestions(su);
1051272
  
1051272
  	/*
1051272
! 	 * While going throught the soundfold tree "su_maxscore" is the score
1051272
  	 * for the soundfold word, limits the changes that are being tried,
1051272
  	 * and "su_sfmaxscore" the rescored score, which is set by
1051272
  	 * cleanup_suggestions().
1051272
--- 10936,10942 ----
1051272
  	    rescore_suggestions(su);
1051272
  
1051272
  	/*
1051272
! 	 * While going through the soundfold tree "su_maxscore" is the score
1051272
  	 * for the soundfold word, limits the changes that are being tried,
1051272
  	 * and "su_sfmaxscore" the rescored score, which is set by
1051272
  	 * cleanup_suggestions().
1051272
***************
1051272
*** 11415,11421 ****
1051272
      char_u	tword[MAXWLEN];	    /* good word collected so far */
1051272
      trystate_T	stack[MAXWLEN];
1051272
      char_u	preword[MAXWLEN * 3]; /* word found with proper case;
1051272
! 				       * concatanation of prefix compound
1051272
  				       * words and split word.  NUL terminated
1051272
  				       * when going deeper but not when coming
1051272
  				       * back. */
1051272
--- 11420,11426 ----
1051272
      char_u	tword[MAXWLEN];	    /* good word collected so far */
1051272
      trystate_T	stack[MAXWLEN];
1051272
      char_u	preword[MAXWLEN * 3]; /* word found with proper case;
1051272
! 				       * concatenation of prefix compound
1051272
  				       * words and split word.  NUL terminated
1051272
  				       * when going deeper but not when coming
1051272
  				       * back. */
1051272
*** ../vim-7.2.331/src/version.c	2010-01-19 12:46:51.000000000 +0100
1051272
--- src/version.c	2010-01-19 13:05:32.000000000 +0100
1051272
***************
1051272
*** 683,684 ****
1051272
--- 683,686 ----
1051272
  {   /* Add new patch number below this line */
1051272
+ /**/
1051272
+     332,
1051272
  /**/
1051272
1051272
-- 
1051272
hundred-and-one symptoms of being an internet addict:
1051272
117. You are more comfortable typing in html.
1051272
1051272
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
1051272
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
1051272
\\\        download, build and distribute -- http://www.A-A-P.org        ///
1051272
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///