JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
Sprinkle some if (running == 0) around sensitive spots; seems to make the
authorMarco Peereboom <marco@conformal.com>
Wed, 30 Sep 2009 17:19:03 +0000 (17:19 +0000)
committerMarco Peereboom <marco@conformal.com>
Wed, 30 Sep 2009 17:19:03 +0000 (17:19 +0000)
intel chip not fuck itself all the time on exit.

scrotwm.c

index 64a8b65..da7e130 100644 (file)
--- a/scrotwm.c
+++ b/scrotwm.c
@@ -4013,6 +4013,8 @@ main(int argc, char *argv[])
        while (running) {
                while (XPending(display)) {
                        XNextEvent(display, &e);
+                       if (running == 0)
+                               goto done;
                        if (e.type < LASTEvent) {
                                dumpevent(&e);
                                if (handler[e.type])
@@ -4038,7 +4040,7 @@ main(int argc, char *argv[])
                /* if we are being restarted go focus on first window */
                if (winfocus) {
                        rr = TAILQ_FIRST(&screens[0].rl);
-                       /* move pointer to first screen */
+                       /* move pointer to first screen if multi screen */
                        if (ScreenCount(display) > 1 || outputs > 1)
                                XWarpPointer(display, None, rr->s[0].root,
                                    0, 0, 0, 0, rr->g.x,
@@ -4053,13 +4055,15 @@ main(int argc, char *argv[])
                FD_SET(xfd, &rd);
                if (select(xfd + 1, &rd, NULL, NULL, NULL) == -1)
                        if (errno != EINTR)
-                               errx(1, "select failed");
+                               DNPRINTF(SWM_D_MISC, "select failed");
+               if (running == 0)
+                       goto done;
                if (bar_alarm) {
                        bar_alarm = 0;
                        bar_update();
                }
        }
-
+done:
        bar_extra_stop();
 
        XCloseDisplay(display);