81c2858
To: vim-dev@vim.org
81c2858
Subject: Patch 7.2.192
81c2858
Fcc: outbox
81c2858
From: Bram Moolenaar <Bram@moolenaar.net>
81c2858
Mime-Version: 1.0
81c2858
Content-Type: text/plain; charset=UTF-8
81c2858
Content-Transfer-Encoding: 8bit
81c2858
------------
81c2858
81c2858
Patch 7.2.192 (after 7.2.188)
81c2858
Problem:    Still a crash in the garbage collector for a very rare situation.
81c2858
Solution:   Make sure current_copyID is always incremented correctly. (Kent
81c2858
	    Sibilev)
81c2858
Files:	    src/eval.c
81c2858
81c2858
81c2858
*** ../vim-7.2.191/src/eval.c	2009-05-26 22:58:43.000000000 +0200
81c2858
--- src/eval.c	2009-05-29 21:13:47.000000000 +0200
81c2858
***************
81c2858
*** 6526,6532 ****
81c2858
  
81c2858
      /* Don't free variables in the previous_funccal list unless they are only
81c2858
       * referenced through previous_funccal.  This must be first, because if
81c2858
!      * the item is referenced elsewhere it must not be freed. */
81c2858
      for (fc = previous_funccal; fc != NULL; fc = fc->caller)
81c2858
      {
81c2858
  	set_ref_in_ht(&fc->l_vars.dv_hashtab, copyID + 1);
81c2858
--- 6526,6532 ----
81c2858
  
81c2858
      /* Don't free variables in the previous_funccal list unless they are only
81c2858
       * referenced through previous_funccal.  This must be first, because if
81c2858
!      * the item is referenced elsewhere the funccal must not be freed. */
81c2858
      for (fc = previous_funccal; fc != NULL; fc = fc->caller)
81c2858
      {
81c2858
  	set_ref_in_ht(&fc->l_vars.dv_hashtab, copyID + 1);
81c2858
***************
81c2858
*** 6564,6573 ****
81c2858
      /* v: vars */
81c2858
      set_ref_in_ht(&vimvarht, copyID);
81c2858
  
81c2858
!     /* Free lists and dictionaries that are not referenced. */
81c2858
      did_free = free_unref_items(copyID);
81c2858
  
81c2858
!     /* check if any funccal can be freed now */
81c2858
      for (pfc = &previous_funccal; *pfc != NULL; )
81c2858
      {
81c2858
  	if (can_free_funccal(*pfc, copyID))
81c2858
--- 6564,6577 ----
81c2858
      /* v: vars */
81c2858
      set_ref_in_ht(&vimvarht, copyID);
81c2858
  
81c2858
!     /*
81c2858
!      * 2. Free lists and dictionaries that are not referenced.
81c2858
!      */
81c2858
      did_free = free_unref_items(copyID);
81c2858
  
81c2858
!     /*
81c2858
!      * 3. Check if any funccal can be freed now.
81c2858
!      */
81c2858
      for (pfc = &previous_funccal; *pfc != NULL; )
81c2858
      {
81c2858
  	if (can_free_funccal(*pfc, copyID))
81c2858
***************
81c2858
*** 9286,9292 ****
81c2858
      if (noref < 0 || noref > 1)
81c2858
  	EMSG(_(e_invarg));
81c2858
      else
81c2858
! 	item_copy(&argvars[0], rettv, TRUE, noref == 0 ? ++current_copyID : 0);
81c2858
  }
81c2858
  
81c2858
  /*
81c2858
--- 9290,9299 ----
81c2858
      if (noref < 0 || noref > 1)
81c2858
  	EMSG(_(e_invarg));
81c2858
      else
81c2858
!     {
81c2858
! 	current_copyID += COPYID_INC;
81c2858
! 	item_copy(&argvars[0], rettv, TRUE, noref == 0 ? current_copyID : 0);
81c2858
!     }
81c2858
  }
81c2858
  
81c2858
  /*
81c2858
***************
81c2858
*** 18966,18972 ****
81c2858
      char_u	*s;
81c2858
      char_u	numbuf[NUMBUFLEN];
81c2858
  
81c2858
!     s = echo_string(&v->di_tv, &tofree, numbuf, ++current_copyID);
81c2858
      list_one_var_a(prefix, v->di_key, v->di_tv.v_type,
81c2858
  					 s == NULL ? (char_u *)"" : s, first);
81c2858
      vim_free(tofree);
81c2858
--- 18973,18980 ----
81c2858
      char_u	*s;
81c2858
      char_u	numbuf[NUMBUFLEN];
81c2858
  
81c2858
!     current_copyID += COPYID_INC;
81c2858
!     s = echo_string(&v->di_tv, &tofree, numbuf, current_copyID);
81c2858
      list_one_var_a(prefix, v->di_key, v->di_tv.v_type,
81c2858
  					 s == NULL ? (char_u *)"" : s, first);
81c2858
      vim_free(tofree);
81c2858
***************
81c2858
*** 19401,19407 ****
81c2858
  	    }
81c2858
  	    else if (eap->cmdidx == CMD_echo)
81c2858
  		msg_puts_attr((char_u *)" ", echo_attr);
81c2858
! 	    p = echo_string(&rettv, &tofree, numbuf, ++current_copyID);
81c2858
  	    if (p != NULL)
81c2858
  		for ( ; *p != NUL && !got_int; ++p)
81c2858
  		{
81c2858
--- 19409,19416 ----
81c2858
  	    }
81c2858
  	    else if (eap->cmdidx == CMD_echo)
81c2858
  		msg_puts_attr((char_u *)" ", echo_attr);
81c2858
! 	    current_copyID += COPYID_INC;
81c2858
! 	    p = echo_string(&rettv, &tofree, numbuf, current_copyID);
81c2858
  	    if (p != NULL)
81c2858
  		for ( ; *p != NUL && !got_int; ++p)
81c2858
  		{
81c2858
*** ../vim-7.2.191/src/version.c	2009-05-26 22:58:43.000000000 +0200
81c2858
--- src/version.c	2009-06-03 13:21:20.000000000 +0200
81c2858
***************
81c2858
*** 678,679 ****
81c2858
--- 678,681 ----
81c2858
  {   /* Add new patch number below this line */
81c2858
+ /**/
81c2858
+     192,
81c2858
  /**/
81c2858
81c2858
-- 
81c2858
Imagine a world without hypothetical situations.
81c2858
81c2858
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
81c2858
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
81c2858
\\\        download, build and distribute -- http://www.A-A-P.org        ///
81c2858
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///