Karsten Hopp 5c1b61
To: vim-dev@vim.org
Karsten Hopp 5c1b61
Subject: Patch 7.0.077
Karsten Hopp 5c1b61
Fcc: outbox
Karsten Hopp 5c1b61
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 5c1b61
Mime-Version: 1.0
Karsten Hopp 5c1b61
Content-Type: text/plain; charset=ISO-8859-1
Karsten Hopp 5c1b61
Content-Transfer-Encoding: 8bit
Karsten Hopp 5c1b61
------------
Karsten Hopp 5c1b61
Karsten Hopp 5c1b61
Patch 7.0.077
Karsten Hopp 5c1b61
Problem:    ":unlet v:this_session" causes a crash. (Marius Roets)
Karsten Hopp 5c1b61
Solution:   When trying to unlet a fixed variable give an error message.
Karsten Hopp 5c1b61
Files:	    src/eval.c
Karsten Hopp 5c1b61
Karsten Hopp 5c1b61
Karsten Hopp 5c1b61
*** ../vim-7.0.076/src/eval.c	Tue Aug 29 21:59:25 2006
Karsten Hopp 5c1b61
--- src/eval.c	Sat Sep  2 13:43:20 2006
Karsten Hopp 5c1b61
***************
Karsten Hopp 5c1b61
*** 701,706 ****
Karsten Hopp 5c1b61
--- 701,707 ----
Karsten Hopp 5c1b61
  static void list_one_var_a __ARGS((char_u *prefix, char_u *name, int type, char_u *string));
Karsten Hopp 5c1b61
  static void set_var __ARGS((char_u *name, typval_T *varp, int copy));
Karsten Hopp 5c1b61
  static int var_check_ro __ARGS((int flags, char_u *name));
Karsten Hopp 5c1b61
+ static int var_check_fixed __ARGS((int flags, char_u *name));
Karsten Hopp 5c1b61
  static int tv_check_lock __ARGS((int lock, char_u *name));
Karsten Hopp 5c1b61
  static void copy_tv __ARGS((typval_T *from, typval_T *to));
Karsten Hopp 5c1b61
  static int item_copy __ARGS((typval_T *from, typval_T *to, int deep, int copyID));
Karsten Hopp 5c1b61
***************
Karsten Hopp 5c1b61
*** 3364,3369 ****
Karsten Hopp 5c1b61
--- 3365,3372 ----
Karsten Hopp 5c1b61
  	hi = hash_find(ht, varname);
Karsten Hopp 5c1b61
  	if (!HASHITEM_EMPTY(hi))
Karsten Hopp 5c1b61
  	{
Karsten Hopp 5c1b61
+ 	    if (var_check_fixed(HI2DI(hi)->di_flags, name))
Karsten Hopp 5c1b61
+ 		return FAIL;
Karsten Hopp 5c1b61
  	    if (var_check_ro(HI2DI(hi)->di_flags, name))
Karsten Hopp 5c1b61
  		return FAIL;
Karsten Hopp 5c1b61
  	    delete_var(ht, hi);
Karsten Hopp 5c1b61
***************
Karsten Hopp 5c1b61
*** 17818,17824 ****
Karsten Hopp 5c1b61
  }
Karsten Hopp 5c1b61
  
Karsten Hopp 5c1b61
  /*
Karsten Hopp 5c1b61
!  * Return TRUE if di_flags "flags" indicate read-only variable "name".
Karsten Hopp 5c1b61
   * Also give an error message.
Karsten Hopp 5c1b61
   */
Karsten Hopp 5c1b61
      static int
Karsten Hopp 5c1b61
--- 17821,17827 ----
Karsten Hopp 5c1b61
  }
Karsten Hopp 5c1b61
  
Karsten Hopp 5c1b61
  /*
Karsten Hopp 5c1b61
!  * Return TRUE if di_flags "flags" indicates variable "name" is read-only.
Karsten Hopp 5c1b61
   * Also give an error message.
Karsten Hopp 5c1b61
   */
Karsten Hopp 5c1b61
      static int
Karsten Hopp 5c1b61
***************
Karsten Hopp 5c1b61
*** 17834,17839 ****
Karsten Hopp 5c1b61
--- 17837,17859 ----
Karsten Hopp 5c1b61
      if ((flags & DI_FLAGS_RO_SBX) && sandbox)
Karsten Hopp 5c1b61
      {
Karsten Hopp 5c1b61
  	EMSG2(_(e_readonlysbx), name);
Karsten Hopp 5c1b61
+ 	return TRUE;
Karsten Hopp 5c1b61
+     }
Karsten Hopp 5c1b61
+     return FALSE;
Karsten Hopp 5c1b61
+ }
Karsten Hopp 5c1b61
+ 
Karsten Hopp 5c1b61
+ /*
Karsten Hopp 5c1b61
+  * Return TRUE if di_flags "flags" indicates variable "name" is fixed.
Karsten Hopp 5c1b61
+  * Also give an error message.
Karsten Hopp 5c1b61
+  */
Karsten Hopp 5c1b61
+     static int
Karsten Hopp 5c1b61
+ var_check_fixed(flags, name)
Karsten Hopp 5c1b61
+     int		flags;
Karsten Hopp 5c1b61
+     char_u	*name;
Karsten Hopp 5c1b61
+ {
Karsten Hopp 5c1b61
+     if (flags & DI_FLAGS_FIX)
Karsten Hopp 5c1b61
+     {
Karsten Hopp 5c1b61
+ 	EMSG2(_("E795: Cannot delete variable %s"), name);
Karsten Hopp 5c1b61
  	return TRUE;
Karsten Hopp 5c1b61
      }
Karsten Hopp 5c1b61
      return FALSE;
Karsten Hopp 5c1b61
*** ../vim-7.0.076/src/version.c	Tue Aug 29 22:35:11 2006
Karsten Hopp 5c1b61
--- src/version.c	Sat Sep  2 13:39:36 2006
Karsten Hopp 5c1b61
***************
Karsten Hopp 5c1b61
*** 668,669 ****
Karsten Hopp 5c1b61
--- 668,671 ----
Karsten Hopp 5c1b61
  {   /* Add new patch number below this line */
Karsten Hopp 5c1b61
+ /**/
Karsten Hopp 5c1b61
+     77,
Karsten Hopp 5c1b61
  /**/
Karsten Hopp 5c1b61
Karsten Hopp 5c1b61
-- 
Karsten Hopp 5c1b61
            ### Hiroshima 45, Chernobyl 86, Windows 95 ###
Karsten Hopp 5c1b61
Karsten Hopp 5c1b61
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 5c1b61
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 5c1b61
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp 5c1b61
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///