Fix synchronization issue with atoms
authorQuentin Rameau <quinq@fifth.space>
Thu, 11 May 2017 22:28:24 +0000 (00:28 +0200)
committerQuentin Rameau <quinq@fifth.space>
Thu, 11 May 2017 22:30:51 +0000 (00:30 +0200)
Be sure to sync after setting an atom.
Sync too before reading one.

surf.c

diff --git a/surf.c b/surf.c
index f02418a..2d3a6f5 100644 (file)
--- a/surf.c
+++ b/surf.c
@@ -530,10 +530,10 @@ geturi(Client *c)
 void
 setatom(Client *c, int a, const char *v)
 {
-       XSync(dpy, False);
        XChangeProperty(dpy, c->xid,
                        atoms[a], XA_STRING, 8, PropModeReplace,
                        (unsigned char *)v, strlen(v) + 1);
+       XSync(dpy, False);
 }
 
 const char *
@@ -545,6 +545,7 @@ getatom(Client *c, int a)
        unsigned long ldummy;
        unsigned char *p = NULL;
 
+       XSync(dpy, False);
        XGetWindowProperty(dpy, c->xid, atoms[a], 0L, BUFSIZ, False, XA_STRING,
                           &adummy, &idummy, &ldummy, &ldummy, &p);
        if (p)