diff options
author | Ethan Marshall <ethan@ethanjmarshall.co.uk> | 2022-08-09 14:55:04 +0100 |
---|---|---|
committer | Ethan Marshall <ethan@ethanjmarshall.co.uk> | 2022-08-09 14:58:20 +0100 |
commit | 96edcd2d020a3f088d70ca0f872602a25957f15c (patch) | |
tree | 80c9727eb47b474384e01838a0f9f0fb3e65cc88 /dwmblocks.c | |
parent | Merge branch 'dfuehrer-fastscroll_fix' (diff) | |
download | dwmblocks-96edcd2d020a3f088d70ca0f872602a25957f15c.tar.gz dwmblocks-96edcd2d020a3f088d70ca0f872602a25957f15c.tar.bz2 dwmblocks-96edcd2d020a3f088d70ca0f872602a25957f15c.tar.xz dwmblocks-96edcd2d020a3f088d70ca0f872602a25957f15c.tar.zst dwmblocks-96edcd2d020a3f088d70ca0f872602a25957f15c.zip |
Fix statusbar freezing
Block signal handlers from running recursively (when a handler is
already running) to avoid deadlock on Xorg connection.
Diffstat (limited to 'dwmblocks.c')
-rw-r--r-- | dwmblocks.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/dwmblocks.c b/dwmblocks.c index 0969ed7..b7f38a7 100644 --- a/dwmblocks.c +++ b/dwmblocks.c @@ -183,6 +183,14 @@ int getstatus(char *str, char *last) void setroot() { + /* block all signals until after root updated */ + sigset_t new, old; + sigfillset(&new); + if (sigprocmask(SIG_SETMASK, &new, &old) < 0) { + perror("sigset"); + exit(1); + } + if (!getstatus(statusstr[0], statusstr[1]))//Only set root if text has changed. return; Display *d = XOpenDisplay(NULL); @@ -192,7 +200,10 @@ void setroot() screen = DefaultScreen(dpy); root = RootWindow(dpy, screen); XStoreName(dpy, root, statusstr[0]); - XCloseDisplay(dpy); + XCloseDisplay(d); + + /* restore signals to default */ + sigprocmask(SIG_SETMASK, &old, NULL); } void pstdout() |