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