aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorN-R-K <79544946+N-R-K@users.noreply.github.com>2022-04-10 12:36:09 +0000
committerGitHub <noreply@github.com>2022-04-10 12:36:09 +0000
commitec5a51d79874d7ef2f54a22b83c3543f086c37da (patch)
tree43d9fa8329fde6c012780d8379be2d75fa727ffa
parent14e9c34ecc399d7b96151f79f1775c8cb5d67a86 (diff)
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.
-rw-r--r--window.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/window.c b/window.c
index b4b9c41..57245e9 100644
--- a/window.c
+++ b/window.c
@@ -73,7 +73,6 @@ static void win_init_font(const win_env_t *e, const char *fontstr)
fontheight = font->ascent + font->descent;
FcPatternGetDouble(font->pattern, FC_SIZE, 0, &fontsize);
barheight = fontheight + 2 * V_TEXT_PAD;
- XftFontClose(e->dpy, font);
}
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)
XFreeCursor(win->env.dpy, cursors[i].icon);
XFreeGC(win->env.dpy, gc);
-
+#if HAVE_LIBFONTS
+ XftFontClose(win->env.dpy, font);
+#endif
XDestroyWindow(win->env.dpy, win->xwin);
XCloseDisplay(win->env.dpy);
}