3ef2ca
To: vim_dev@googlegroups.com
3ef2ca
Subject: Patch 7.4.040
3ef2ca
Fcc: outbox
3ef2ca
From: Bram Moolenaar <Bram@moolenaar.net>
3ef2ca
Mime-Version: 1.0
3ef2ca
Content-Type: text/plain; charset=UTF-8
3ef2ca
Content-Transfer-Encoding: 8bit
3ef2ca
------------
3ef2ca
3ef2ca
Patch 7.4.040
3ef2ca
Problem:    Valgrind error on exit when a script-local variable holds a
3ef2ca
	    reference to the scope of another script.
3ef2ca
Solution:   First clear all variables, then free the scopes. (ZyX)
3ef2ca
Files:	    src/eval.c
3ef2ca
3ef2ca
3ef2ca
*** ../vim-7.4.039/src/eval.c	2013-08-30 16:35:41.000000000 +0200
3ef2ca
--- src/eval.c	2013-09-25 20:28:15.000000000 +0200
3ef2ca
***************
3ef2ca
*** 915,926 ****
3ef2ca
      /* autoloaded script names */
3ef2ca
      ga_clear_strings(&ga_loaded);
3ef2ca
  
3ef2ca
!     /* script-local variables */
3ef2ca
      for (i = 1; i <= ga_scripts.ga_len; ++i)
3ef2ca
-     {
3ef2ca
  	vars_clear(&SCRIPT_VARS(i));
3ef2ca
  	vim_free(SCRIPT_SV(i));
3ef2ca
-     }
3ef2ca
      ga_clear(&ga_scripts);
3ef2ca
  
3ef2ca
      /* unreferenced lists and dicts */
3ef2ca
--- 915,927 ----
3ef2ca
      /* autoloaded script names */
3ef2ca
      ga_clear_strings(&ga_loaded);
3ef2ca
  
3ef2ca
!     /* Script-local variables. First clear all the variables and in a second
3ef2ca
!      * loop free the scriptvar_T, because a variable in one script might hold
3ef2ca
!      * a reference to the whole scope of another script. */
3ef2ca
      for (i = 1; i <= ga_scripts.ga_len; ++i)
3ef2ca
  	vars_clear(&SCRIPT_VARS(i));
3ef2ca
+     for (i = 1; i <= ga_scripts.ga_len; ++i)
3ef2ca
  	vim_free(SCRIPT_SV(i));
3ef2ca
      ga_clear(&ga_scripts);
3ef2ca
  
3ef2ca
      /* unreferenced lists and dicts */
3ef2ca
*** ../vim-7.4.039/src/version.c	2013-09-25 19:13:32.000000000 +0200
3ef2ca
--- src/version.c	2013-09-25 20:30:06.000000000 +0200
3ef2ca
***************
3ef2ca
*** 740,741 ****
3ef2ca
--- 740,743 ----
3ef2ca
  {   /* Add new patch number below this line */
3ef2ca
+ /**/
3ef2ca
+     40,
3ef2ca
  /**/
3ef2ca
3ef2ca
-- 
3ef2ca
    A KNIGHT rides into shot and hacks him to the ground.  He rides off.
3ef2ca
    We stay for a moment on the glade.  A MIDDLE-AGED LADY in a C. & A.
3ef2ca
    twin-set emerges from the trees and looks in horror at the body of her
3ef2ca
    HUSBAND.
3ef2ca
MRS HISTORIAN: FRANK!
3ef2ca
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
3ef2ca
3ef2ca
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
3ef2ca
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
3ef2ca
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
3ef2ca
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///