Hi,

2012/10/19 Fri 10:08:26 UTC+9 Tony Mechelynck:
> Hm... Isn't a similar addition necessary for the fontset case, before 
> line 8086?

I'm not sure because the fontset case isn't used on Windows,
but it seems necessary. I have updated the patch.
Can anyone test this patch on Linux or other OS?

Best regards,
Ken Takata

-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
# HG changeset patch
# Parent 833a3180982f63bdeeb06c1f8448ecd4cc41b25d
fix font resource leak

see:
  https://groups.google.com/d/topic/vim_dev/-TJM3cfWIDQ/discussion

  todo.txt
> Highlighting stops working after changing it many times.  Script to reproduce
> it: Pablo Contreras, 2010 Oct 12  Windows XP and 7.  Font is never freed?

diff --git a/src/syntax.c b/src/syntax.c
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -8083,6 +8083,8 @@
 	|| do_tooltip
 #  endif
 	    )
+	if (HL_TABLE()[idx].sg_fontset != NOFONTSET)
+	    gui_mch_free_fontset(HL_TABLE()[idx].sg_fontset);
 	HL_TABLE()[idx].sg_fontset = fontset_name2handle(arg, 0
 #  ifdef FONTSET_ALWAYS
 		|| do_menu
@@ -8126,6 +8128,8 @@
     else
 # endif
     {
+	if (HL_TABLE()[idx].sg_font != NOFONT)
+	    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. */

Raspunde prin e-mail lui