Fixed potential font memory issue

The font was not retained when setting gui.norm_font leading to a pointer into
freed memory.  The font instance is now retained before its pointer value is
stored in gui.norm_font.
This commit is contained in:
Bjorn Winckler
2008-01-07 20:28:10 +01:00
parent 38a4d64829
commit 46b5d6e03d
+1 -1
View File
@@ -851,7 +851,7 @@ gui_mch_init_font(char_u *font_name, int fontset)
NSFont *font = gui_macvim_font_with_name(font_name);
if (font) {
[(NSFont*)gui.norm_font release];
gui.norm_font = (GuiFont)font;
gui.norm_font = (GuiFont)[font retain];
// NOTE: MacVim keeps separate track of the normal and wide fonts.
// Unless the user changes 'guifontwide' manually, they are based on