Lazy font unloading too.

This commit is contained in:
Christoph Lohmann 2013-05-11 21:59:55 +02:00
parent 62502a88e9
commit 8f47c4a4de

25
st.c
View file

@ -369,6 +369,7 @@ static void xresettitle(void);
static void xseturgency(int); static void xseturgency(int);
static void xsetsel(char*); static void xsetsel(char*);
static void xtermclear(int, int, int, int); static void xtermclear(int, int, int, int);
static void xunloadfont(Font *f);
static void xunloadfonts(void); static void xunloadfonts(void);
static void xresize(int, int); static void xresize(int, int);
@ -2733,6 +2734,14 @@ xloadfontset(Font *f) {
return 0; return 0;
} }
void
xunloadfont(Font *f) {
XftFontClose(xw.dpy, f->match);
FcPatternDestroy(f->pattern);
if(f->set)
FcFontSetDestroy(f->set);
}
void void
xunloadfonts(void) { xunloadfonts(void) {
int i, ip; int i, ip;
@ -2749,18 +2758,10 @@ xunloadfonts(void) {
frccur = -1; frccur = -1;
frclen = 0; frclen = 0;
XftFontClose(xw.dpy, dc.font.match); xunloadfont(&dc.font);
FcPatternDestroy(dc.font.pattern); xunloadfont(&dc.bfont);
FcFontSetDestroy(dc.font.set); xunloadfont(&dc.ifont);
XftFontClose(xw.dpy, dc.bfont.match); xunloadfont(&dc.ibfont);
FcPatternDestroy(dc.bfont.pattern);
FcFontSetDestroy(dc.bfont.set);
XftFontClose(xw.dpy, dc.ifont.match);
FcPatternDestroy(dc.ifont.pattern);
FcFontSetDestroy(dc.ifont.set);
XftFontClose(xw.dpy, dc.ibfont.match);
FcPatternDestroy(dc.ibfont.pattern);
FcFontSetDestroy(dc.ibfont.set);
} }
void void