Free fonts on shutdown. - sam - An updated version of the sam text editor. | |
git clone git://vernunftzentrum.de/sam.git | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit 89bfb55657c7381504115ef970090e3aa736c8b7 | |
parent 6db38896e8c2d17bcd2a3534c26bf507f9614f3c | |
Author: Rob King <[email protected]> | |
Date: Thu, 24 Nov 2016 23:52:22 -0600 | |
Free fonts on shutdown. | |
Diffstat: | |
libXg/xtbinit.c | 9 +++++++++ | |
1 file changed, 9 insertions(+), 0 deletions(-) | |
--- | |
diff --git a/libXg/xtbinit.c b/libXg/xtbinit.c | |
@@ -2,6 +2,7 @@ | |
#include <u.h> | |
#include <libg.h> | |
#include <stdio.h> | |
+#include <stdlib.h> | |
#include <string.h> | |
#include "libgint.h" | |
@@ -127,6 +128,13 @@ static uint8_t darkgreybits[] = { | |
}; | |
void | |
+freefont(void) | |
+{ | |
+ if (font) | |
+ XftFontClose(_dpy, font); | |
+} | |
+ | |
+void | |
xtbinit(Errfunc f, char *class, int *pargc, char **argv, char **fallbacks) | |
{ | |
int n; | |
@@ -206,6 +214,7 @@ xtbinit(Errfunc f, char *class, int *pargc, char **argv, ch… | |
screen.id = 0; | |
XtRealizeWidget(_toplevel); | |
_topwindow = XtWindow(_toplevel); | |
+ atexit(freefont); | |
pid_t pid = getpid(); | |
XChangeProperty(_dpy, XtWindow(_toplevel), XInternAtom(_dpy, "_NET_WM_PID"… |