Fix synchronization issue with atoms

Be sure to sync after setting an atom.
Sync too before reading one.
This commit is contained in:
Quentin Rameau 2017-05-12 00:28:24 +02:00
parent 5e2216c414
commit f5be376ccc

3
surf.c
View file

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