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