Krolyxon
Commit ec5a51d

Branches

Refs →

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.
Author
N-R-K
Date
2022-04-10 12:36 +0000
Committer
GitHub · 2022-04-10 12:36 +0000
Parent
14e9c34
Commit
ec5a51d79874d7ef2f54a22b83c3543f086c37da

+3 −2

1 file changed

  1. M window.c +3 −2
M window.c View
@@ -73,7 +73,6 @@ static void win_init_font(const win_env_t *e, const char *fontstr)
7373 fontheight = font->ascent + font->descent;
7474 FcPatternGetDouble(font->pattern, FC_SIZE, 0, &fontsize);
7575 barheight = fontheight + 2 * V_TEXT_PAD;
76− XftFontClose(e->dpy, font);
7776 }
7877
7978 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)
336335 XFreeCursor(win->env.dpy, cursors[i].icon);
337336
338337 XFreeGC(win->env.dpy, gc);
339−
338+#if HAVE_LIBFONTS
339+ XftFontClose(win->env.dpy, font);
340+#endif
340341 XDestroyWindow(win->env.dpy, win->xwin);
341342 XCloseDisplay(win->env.dpy);
342343 }