[vim/f18] - patchlevel 697

Karsten Hopp karsten at fedoraproject.org
Mon Nov 12 14:32:45 UTC 2012


commit cb6b9638e2127bb108feb7571b9f63bc6db9f381
Author: Karsten Hopp <karsten at redhat.com>
Date:   Mon Nov 12 15:31:15 2012 +0100

    - patchlevel 697

 7.3.697 |  188 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 188 insertions(+), 0 deletions(-)
---
diff --git a/7.3.697 b/7.3.697
new file mode 100644
index 0000000..b8d7814
--- /dev/null
+++ b/7.3.697
@@ -0,0 +1,188 @@
+To: vim_dev at googlegroups.com
+Subject: Patch 7.3.697
+Fcc: outbox
+From: Bram Moolenaar <Bram at moolenaar.net>
+Mime-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+------------
+
+Patch 7.3.697
+Problem:    Leaking resources when setting GUI font.
+Solution:   Free the font. (Ken Takata)
+Files:      src/syntax.c
+
+
+*** ../vim-7.3.696/src/syntax.c	2012-07-19 17:39:01.000000000 +0200
+--- src/syntax.c	2012-10-21 01:37:19.000000000 +0200
+***************
+*** 105,111 ****
+  # ifdef FEAT_XFONTSET
+  static GuiFontset fontset_name2handle __ARGS((char_u *name, int fixed_width));
+  # endif
+! static void hl_do_font __ARGS((int idx, char_u *arg, int do_normal, int do_menu, int do_tooltip));
+  #endif
+  
+  /*
+--- 105,111 ----
+  # ifdef FEAT_XFONTSET
+  static GuiFontset fontset_name2handle __ARGS((char_u *name, int fixed_width));
+  # endif
+! static void hl_do_font __ARGS((int idx, char_u *arg, int do_normal, int do_menu, int do_tooltip, int free_font));
+  #endif
+  
+  /*
+***************
+*** 7259,7272 ****
+  		HL_TABLE()[idx].sg_fontset = NOFONTSET;
+  # endif
+  		hl_do_font(idx, arg, is_normal_group, is_menu_group,
+! 							    is_tooltip_group);
+  
+  # ifdef FEAT_XFONTSET
+  		if (HL_TABLE()[idx].sg_fontset != NOFONTSET)
+  		{
+! 		    /* New fontset was accepted. Free the old one, if there was
+! 		     * one.
+! 		     */
+  		    gui_mch_free_fontset(temp_sg_fontset);
+  		    vim_free(HL_TABLE()[idx].sg_font_name);
+  		    HL_TABLE()[idx].sg_font_name = vim_strsave(arg);
+--- 7259,7271 ----
+  		HL_TABLE()[idx].sg_fontset = NOFONTSET;
+  # endif
+  		hl_do_font(idx, arg, is_normal_group, is_menu_group,
+! 						     is_tooltip_group, FALSE);
+  
+  # ifdef FEAT_XFONTSET
+  		if (HL_TABLE()[idx].sg_fontset != NOFONTSET)
+  		{
+! 		    /* New fontset was accepted. Free the old one, if there
+! 		     * was one. */
+  		    gui_mch_free_fontset(temp_sg_fontset);
+  		    vim_free(HL_TABLE()[idx].sg_font_name);
+  		    HL_TABLE()[idx].sg_font_name = vim_strsave(arg);
+***************
+*** 7277,7284 ****
+  		if (HL_TABLE()[idx].sg_font != NOFONT)
+  		{
+  		    /* New font was accepted. Free the old one, if there was
+! 		     * one.
+! 		     */
+  		    gui_mch_free_font(temp_sg_font);
+  		    vim_free(HL_TABLE()[idx].sg_font_name);
+  		    HL_TABLE()[idx].sg_font_name = vim_strsave(arg);
+--- 7276,7282 ----
+  		if (HL_TABLE()[idx].sg_font != NOFONT)
+  		{
+  		    /* New font was accepted. Free the old one, if there was
+! 		     * one. */
+  		    gui_mch_free_font(temp_sg_font);
+  		    vim_free(HL_TABLE()[idx].sg_font_name);
+  		    HL_TABLE()[idx].sg_font_name = vim_strsave(arg);
+***************
+*** 8064,8075 ****
+   * Get the font or fontset for one highlight group.
+   */
+      static void
+! hl_do_font(idx, arg, do_normal, do_menu, do_tooltip)
+      int		idx;
+      char_u	*arg;
+      int		do_normal;		/* set normal font */
+      int		do_menu UNUSED;		/* set menu font */
+      int		do_tooltip UNUSED;	/* set tooltip font */
+  {
+  # ifdef FEAT_XFONTSET
+      /* If 'guifontset' is not empty, first try using the name as a
+--- 8062,8074 ----
+   * Get the font or fontset for one highlight group.
+   */
+      static void
+! hl_do_font(idx, arg, do_normal, do_menu, do_tooltip, free_font)
+      int		idx;
+      char_u	*arg;
+      int		do_normal;		/* set normal font */
+      int		do_menu UNUSED;		/* set menu font */
+      int		do_tooltip UNUSED;	/* set tooltip font */
++     int		free_font;		/* free current font/fontset */
+  {
+  # ifdef FEAT_XFONTSET
+      /* If 'guifontset' is not empty, first try using the name as a
+***************
+*** 8083,8088 ****
+--- 8082,8089 ----
+  	|| do_tooltip
+  #  endif
+  	    )
++ 	if (free_fontset)
++ 	    gui_mch_free_fontset(HL_TABLE()[idx].sg_fontset);
+  	HL_TABLE()[idx].sg_fontset = fontset_name2handle(arg, 0
+  #  ifdef FONTSET_ALWAYS
+  		|| do_menu
+***************
+*** 8093,8100 ****
+  		);
+      if (HL_TABLE()[idx].sg_fontset != NOFONTSET)
+      {
+! 	/* If it worked and it's the Normal group, use it as the
+! 	 * normal fontset.  Same for the Menu group. */
+  	if (do_normal)
+  	    gui_init_font(arg, TRUE);
+  #   if (defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_ATHENA)) && defined(FEAT_MENU)
+--- 8094,8101 ----
+  		);
+      if (HL_TABLE()[idx].sg_fontset != NOFONTSET)
+      {
+! 	/* If it worked and it's the Normal group, use it as the normal
+! 	 * fontset.  Same for the Menu group. */
+  	if (do_normal)
+  	    gui_init_font(arg, TRUE);
+  #   if (defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_ATHENA)) && defined(FEAT_MENU)
+***************
+*** 8126,8131 ****
+--- 8127,8134 ----
+      else
+  # endif
+      {
++ 	if (free_font)
++ 	    gui_mch_free_font(HL_TABLE()[idx].sg_font);
+  	HL_TABLE()[idx].sg_font = font_name2handle(arg);
+  	/* If it worked and it's the Normal group, use it as the
+  	 * normal font.  Same for the Menu group. */
+***************
+*** 9162,9168 ****
+      if (HL_TABLE()[idx].sg_font_name != NULL)
+      {
+  	hl_do_font(idx, HL_TABLE()[idx].sg_font_name, FALSE, do_menu,
+! 		   do_tooltip);
+  	didit = TRUE;
+      }
+      if (HL_TABLE()[idx].sg_gui_fg_name != NULL)
+--- 9165,9171 ----
+      if (HL_TABLE()[idx].sg_font_name != NULL)
+      {
+  	hl_do_font(idx, HL_TABLE()[idx].sg_font_name, FALSE, do_menu,
+! 							    do_tooltip, TRUE);
+  	didit = TRUE;
+      }
+      if (HL_TABLE()[idx].sg_gui_fg_name != NULL)
+*** ../vim-7.3.696/src/version.c	2012-10-21 01:21:53.000000000 +0200
+--- src/version.c	2012-10-21 01:27:55.000000000 +0200
+***************
+*** 721,722 ****
+--- 721,724 ----
+  {   /* Add new patch number below this line */
++ /**/
++     697,
+  /**/
+
+-- 
+BEDEVERE: Wait.  Wait ... tell me, what also floats on water?
+ALL:      Bread?  No, no, no.  Apples .... gravy ... very small rocks ...
+ARTHUR:   A duck.
+                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
+
+ /// Bram Moolenaar -- Bram at Moolenaar.net -- http://www.Moolenaar.net   \\\
+///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
+\\\  an exciting new programming language -- http://www.Zimbu.org        ///
+ \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///


More information about the scm-commits mailing list