summaryrefslogtreecommitdiff
path: root/src/vwm.c
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@gnugeneration.com>2017-02-22 09:57:52 -0800
committerGitHub <noreply@github.com>2017-02-22 09:57:52 -0800
commit01cdfeea061ab3339b4e5cbf0964005d4c15bd5e (patch)
treec6d74a8551ee344e22795bb577095ef3fb5f5eba /src/vwm.c
parent5b50e2a3affddb5693b91846b6c621590b8d21b2 (diff)
parent3d8f1432e555af373e7ccc3b6fffc80b70533888 (diff)
Trivial cleanup and small (but continuous) memory leak fix
Tidy up vwm exit handling and stop leaking an X Region on every clean vwm_composite_paint_all(). If you noticed very long-running vwm instances hogging memory like a web browser, this is the culprit, vwm doesn't typically need much memory.
Diffstat (limited to 'src/vwm.c')
-rw-r--r--src/vwm.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/vwm.c b/src/vwm.c
index c2e5126..d0dc47e 100644
--- a/src/vwm.c
+++ b/src/vwm.c
@@ -69,11 +69,11 @@ static int errhandler(Display *display, XErrorEvent *err)
int main(int argc, char *argv[])
{
int err = 0;
- int done = 0;
XEvent event;
Cursor pointer;
struct pollfd pfd;
char *console_args[] = {"xterm", "-class", CONSOLE_WM_CLASS, "-e", "/bin/sh", "-c", "screen -D -RR " CONSOLE_SESSION_STRING, NULL};
+ char *quit_console_args[] = {"/bin/sh", "-c", "screen -dr " CONSOLE_SESSION_STRING " -X quit", NULL};
#define reterr_if(_cond, _fmt, _args...) \
err++;\
@@ -168,7 +168,7 @@ int main(int argc, char *argv[])
pfd.revents = 0;
pfd.fd = ConnectionNumber(vwm.display);
- while (!done) {
+ while (!vwm.done) {
do {
int delay;
@@ -283,6 +283,9 @@ int main(int argc, char *argv[])
vwm_composite_paint_all(&vwm);
}
+ /* tear down console */
+ vwm_launch(&vwm, quit_console_args, VWM_LAUNCH_MODE_FG);
+
/* close connection to server */
XFlush(vwm.display);
XCloseDisplay(vwm.display);
© All Rights Reserved