Karsten Hopp aa6209
To: vim-dev@vim.org
Karsten Hopp aa6209
Subject: Patch 7.2.126
Karsten Hopp aa6209
Fcc: outbox
Karsten Hopp aa6209
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp aa6209
Mime-Version: 1.0
Karsten Hopp aa6209
Content-Type: text/plain; charset=ISO-8859-1
Karsten Hopp aa6209
Content-Transfer-Encoding: 8bit
Karsten Hopp aa6209
------------
Karsten Hopp aa6209
Karsten Hopp aa6209
Patch 7.2.126
Karsten Hopp aa6209
Problem:    When EXITFREE is defined signs are not freed.
Karsten Hopp aa6209
Solution:   Free all signs on exit.  Also free keymaps. (Dominique Pelle)
Karsten Hopp aa6209
Files:      src/misc2.c, src/ex_cmds.c, src/proto/ex_cmds.pro
Karsten Hopp aa6209
Karsten Hopp aa6209
Karsten Hopp aa6209
*** ../vim-7.2.125/src/misc2.c	Thu Jan 22 21:31:24 2009
Karsten Hopp aa6209
--- src/misc2.c	Sun Feb 22 22:04:53 2009
Karsten Hopp aa6209
***************
Karsten Hopp aa6209
*** 1010,1015 ****
Karsten Hopp aa6209
--- 1010,1018 ----
Karsten Hopp aa6209
  # if defined(FEAT_PROFILE)
Karsten Hopp aa6209
      do_cmdline_cmd((char_u *)"profdel *");
Karsten Hopp aa6209
  # endif
Karsten Hopp aa6209
+ # if defined(FEAT_KEYMAP)
Karsten Hopp aa6209
+     do_cmdline_cmd((char_u *)"set keymap=");
Karsten Hopp aa6209
+ #endif
Karsten Hopp aa6209
  
Karsten Hopp aa6209
  # ifdef FEAT_TITLE
Karsten Hopp aa6209
      free_titles();
Karsten Hopp aa6209
***************
Karsten Hopp aa6209
*** 1034,1039 ****
Karsten Hopp aa6209
--- 1037,1045 ----
Karsten Hopp aa6209
      free_regexp_stuff();
Karsten Hopp aa6209
      free_tag_stuff();
Karsten Hopp aa6209
      free_cd_dir();
Karsten Hopp aa6209
+ # ifdef FEAT_SIGNS
Karsten Hopp aa6209
+     free_signs();
Karsten Hopp aa6209
+ # endif
Karsten Hopp aa6209
  # ifdef FEAT_EVAL
Karsten Hopp aa6209
      set_expr_line(NULL);
Karsten Hopp aa6209
  # endif
Karsten Hopp aa6209
*** ../vim-7.2.125/src/ex_cmds.c	Wed Feb 11 16:02:29 2009
Karsten Hopp aa6209
--- src/ex_cmds.c	Sun Feb 22 22:07:08 2009
Karsten Hopp aa6209
***************
Karsten Hopp aa6209
*** 6541,6546 ****
Karsten Hopp aa6209
--- 6541,6547 ----
Karsten Hopp aa6209
  static int	last_sign_typenr = MAX_TYPENR;	/* is decremented */
Karsten Hopp aa6209
  
Karsten Hopp aa6209
  static void sign_list_defined __ARGS((sign_T *sp));
Karsten Hopp aa6209
+ static void sign_undefine __ARGS((sign_T *sp, sign_T *sp_prev));
Karsten Hopp aa6209
  
Karsten Hopp aa6209
  /*
Karsten Hopp aa6209
   * ":sign" command
Karsten Hopp aa6209
***************
Karsten Hopp aa6209
*** 6749,6772 ****
Karsten Hopp aa6209
  		/* ":sign list {name}" */
Karsten Hopp aa6209
  		sign_list_defined(sp);
Karsten Hopp aa6209
  	    else
Karsten Hopp aa6209
- 	    {
Karsten Hopp aa6209
  		/* ":sign undefine {name}" */
Karsten Hopp aa6209
! 		vim_free(sp->sn_name);
Karsten Hopp aa6209
! 		vim_free(sp->sn_icon);
Karsten Hopp aa6209
! #ifdef FEAT_SIGN_ICONS
Karsten Hopp aa6209
! 		if (sp->sn_image != NULL)
Karsten Hopp aa6209
! 		{
Karsten Hopp aa6209
! 		    out_flush();
Karsten Hopp aa6209
! 		    gui_mch_destroy_sign(sp->sn_image);
Karsten Hopp aa6209
! 		}
Karsten Hopp aa6209
! #endif
Karsten Hopp aa6209
! 		vim_free(sp->sn_text);
Karsten Hopp aa6209
! 		if (sp_prev == NULL)
Karsten Hopp aa6209
! 		    first_sign = sp->sn_next;
Karsten Hopp aa6209
! 		else
Karsten Hopp aa6209
! 		    sp_prev->sn_next = sp->sn_next;
Karsten Hopp aa6209
! 		vim_free(sp);
Karsten Hopp aa6209
! 	    }
Karsten Hopp aa6209
  	}
Karsten Hopp aa6209
      }
Karsten Hopp aa6209
      else
Karsten Hopp aa6209
--- 6750,6757 ----
Karsten Hopp aa6209
  		/* ":sign list {name}" */
Karsten Hopp aa6209
  		sign_list_defined(sp);
Karsten Hopp aa6209
  	    else
Karsten Hopp aa6209
  		/* ":sign undefine {name}" */
Karsten Hopp aa6209
! 		sign_undefine(sp, sp_prev);
Karsten Hopp aa6209
  	}
Karsten Hopp aa6209
      }
Karsten Hopp aa6209
      else
Karsten Hopp aa6209
***************
Karsten Hopp aa6209
*** 7015,7020 ****
Karsten Hopp aa6209
--- 7000,7030 ----
Karsten Hopp aa6209
  }
Karsten Hopp aa6209
  
Karsten Hopp aa6209
  /*
Karsten Hopp aa6209
+  * Undefine a sign and free its memory.
Karsten Hopp aa6209
+  */
Karsten Hopp aa6209
+     static void
Karsten Hopp aa6209
+ sign_undefine(sp, sp_prev)
Karsten Hopp aa6209
+     sign_T	*sp;
Karsten Hopp aa6209
+     sign_T	*sp_prev;
Karsten Hopp aa6209
+ {
Karsten Hopp aa6209
+     vim_free(sp->sn_name);
Karsten Hopp aa6209
+     vim_free(sp->sn_icon);
Karsten Hopp aa6209
+ #ifdef FEAT_SIGN_ICONS
Karsten Hopp aa6209
+     if (sp->sn_image != NULL)
Karsten Hopp aa6209
+     {
Karsten Hopp aa6209
+ 	out_flush();
Karsten Hopp aa6209
+ 	gui_mch_destroy_sign(sp->sn_image);
Karsten Hopp aa6209
+     }
Karsten Hopp aa6209
+ #endif
Karsten Hopp aa6209
+     vim_free(sp->sn_text);
Karsten Hopp aa6209
+     if (sp_prev == NULL)
Karsten Hopp aa6209
+ 	first_sign = sp->sn_next;
Karsten Hopp aa6209
+     else
Karsten Hopp aa6209
+ 	sp_prev->sn_next = sp->sn_next;
Karsten Hopp aa6209
+     vim_free(sp);
Karsten Hopp aa6209
+ }
Karsten Hopp aa6209
+ 
Karsten Hopp aa6209
+ /*
Karsten Hopp aa6209
   * Get highlighting attribute for sign "typenr".
Karsten Hopp aa6209
   * If "line" is TRUE: line highl, if FALSE: text highl.
Karsten Hopp aa6209
   */
Karsten Hopp aa6209
***************
Karsten Hopp aa6209
*** 7088,7093 ****
Karsten Hopp aa6209
--- 7098,7115 ----
Karsten Hopp aa6209
      return (char_u *)_("[Deleted]");
Karsten Hopp aa6209
  }
Karsten Hopp aa6209
  
Karsten Hopp aa6209
+ #if defined(EXITFREE) || defined(PROTO)
Karsten Hopp aa6209
+ /*
Karsten Hopp aa6209
+  * Undefine/free all signs.
Karsten Hopp aa6209
+  */
Karsten Hopp aa6209
+     void
Karsten Hopp aa6209
+ free_signs()
Karsten Hopp aa6209
+ {
Karsten Hopp aa6209
+     while (first_sign != NULL)
Karsten Hopp aa6209
+ 	sign_undefine(first_sign, NULL);
Karsten Hopp aa6209
+ }
Karsten Hopp aa6209
+ #endif
Karsten Hopp aa6209
+ 
Karsten Hopp aa6209
  #endif
Karsten Hopp aa6209
  
Karsten Hopp aa6209
  #if defined(FEAT_GUI) || defined(FEAT_CLIENTSERVER) || defined(PROTO)
Karsten Hopp aa6209
*** ../vim-7.2.125/src/proto/ex_cmds.pro	Sat Nov 15 14:10:23 2008
Karsten Hopp aa6209
--- src/proto/ex_cmds.pro	Sun Feb 22 22:04:53 2009
Karsten Hopp aa6209
***************
Karsten Hopp aa6209
*** 40,45 ****
Karsten Hopp aa6209
--- 40,46 ----
Karsten Hopp aa6209
  int read_viminfo_sub_string __ARGS((vir_T *virp, int force));
Karsten Hopp aa6209
  void write_viminfo_sub_string __ARGS((FILE *fp));
Karsten Hopp aa6209
  void free_old_sub __ARGS((void));
Karsten Hopp aa6209
+ void free_signs __ARGS((void));
Karsten Hopp aa6209
  int prepare_tagpreview __ARGS((int undo_sync));
Karsten Hopp aa6209
  void ex_help __ARGS((exarg_T *eap));
Karsten Hopp aa6209
  char_u *check_help_lang __ARGS((char_u *arg));
Karsten Hopp aa6209
*** ../vim-7.2.125/src/version.c	Tue Feb 24 04:11:07 2009
Karsten Hopp aa6209
--- src/version.c	Tue Feb 24 04:24:46 2009
Karsten Hopp aa6209
***************
Karsten Hopp aa6209
*** 678,679 ****
Karsten Hopp aa6209
--- 678,681 ----
Karsten Hopp aa6209
  {   /* Add new patch number below this line */
Karsten Hopp aa6209
+ /**/
Karsten Hopp aa6209
+     126,
Karsten Hopp aa6209
  /**/
Karsten Hopp aa6209
Karsten Hopp aa6209
-- 
Karsten Hopp aa6209
hundred-and-one symptoms of being an internet addict:
Karsten Hopp aa6209
125. You begin to wonder how often it REALLY is necessary to get up
Karsten Hopp aa6209
     and shower or bathe.
Karsten Hopp aa6209
Karsten Hopp aa6209
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp aa6209
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp aa6209
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp aa6209
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///