Skip to content
This repository
Browse code

Fix leak when switching XFT fonts

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...
commit ef8829b55eb29f03d780e0553c54271c0711dce5 1 parent f426751
Jari Vetoniemi authored December 02, 2012

Showing 1 changed file with 2 additions and 0 deletions. Show diff stats Hide diff stats

  1. 2  draw.c
2  draw.c
@@ -155,6 +155,8 @@ setfont(const char *fontstr) {
155 155
 	}
156 156
 	dzen.font.height = dzen.font.ascent + dzen.font.descent;
157 157
 #else
  158
+        if(dzen.font.xftfont)
  159
+           XftFontClose(dzen.dpy, dzen.font.xftfont);
158 160
 	dzen.font.xftfont = XftFontOpenXlfd(dzen.dpy, dzen.screen, fontstr);
159 161
 	if(!dzen.font.xftfont)
160 162
 	   dzen.font.xftfont = XftFontOpenName(dzen.dpy, dzen.screen, fontstr);

0 notes on commit ef8829b

Please sign in to comment.
Something went wrong with that request. Please try again.