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