Skip to content

Commit

Permalink
Fix leak when switching XFT fonts
Browse files Browse the repository at this point in the history
Switching fonts on dzen's XFT builds using fn() command, causes
the old font to not get unloaded, hence slowly leaking memory.
  • Loading branch information
Cloudef committed Dec 2, 2012
1 parent f426751 commit ef8829b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ setfont(const char *fontstr) {
}
dzen.font.height = dzen.font.ascent + dzen.font.descent;
#else
if(dzen.font.xftfont)
XftFontClose(dzen.dpy, dzen.font.xftfont);
dzen.font.xftfont = XftFontOpenXlfd(dzen.dpy, dzen.screen, fontstr);
if(!dzen.font.xftfont)
dzen.font.xftfont = XftFontOpenName(dzen.dpy, dzen.screen, fontstr);
Expand Down

0 comments on commit ef8829b

Please sign in to comment.