nsxivec5a51d
fix: correctly close the font (#250)
currently we immediately close the font on win_init_font(), which was introduced in 0d8dcfd. this was probably not correct since we use `font` later in win_draw_text(). instead, the font should be closed at exit/cleanup.
+3 −2
1 file changed
- M window.c +3 −2
| @@ -73,7 +73,6 @@ static void win_init_font(const win_env_t *e, const char *fontstr) | |||
| 73 | 73 | fontheight = font->ascent + font->descent; | |
| 74 | 74 | FcPatternGetDouble(font->pattern, FC_SIZE, 0, &fontsize); | |
| 75 | 75 | barheight = fontheight + 2 * V_TEXT_PAD; | |
| 76 | − | XftFontClose(e->dpy, font); | |
| 77 | 76 | } | |
| 78 | 77 | ||
| 79 | 78 | static void xft_alloc_color(const win_env_t *e, const char *name, XftColor *col) | |
| @@ -336,7 +335,9 @@ CLEANUP void win_close(win_t *win) | |||
| 336 | 335 | XFreeCursor(win->env.dpy, cursors[i].icon); | |
| 337 | 336 | ||
| 338 | 337 | XFreeGC(win->env.dpy, gc); | |
| 339 | − | ||
| 338 | + | #if HAVE_LIBFONTS | |
| 339 | + | XftFontClose(win->env.dpy, font); | |
| 340 | + | #endif | |
| 340 | 341 | XDestroyWindow(win->env.dpy, win->xwin); | |
| 341 | 342 | XCloseDisplay(win->env.dpy); | |
| 342 | 343 | } | |