swap the order of X11 and clipboard locks (#4)

This commit is contained in:
therealfun 2021-02-01 22:32:06 +02:00 committed by GitHub
parent 21ff7e50fd
commit faa533e2e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1495,8 +1495,8 @@ rpc_getsnarf(void)
XWindow xw; XWindow xw;
Xwin *w; Xwin *w;
qlock(&clip.lk);
xlock(); xlock();
qlock(&clip.lk);
w = _x.windows; w = _x.windows;
/* /*
* Have we snarfed recently and the X server hasn't caught up? * Have we snarfed recently and the X server hasn't caught up?
@ -1540,8 +1540,8 @@ rpc_getsnarf(void)
} }
out: out:
xunlock();
qunlock(&clip.lk); qunlock(&clip.lk);
xunlock();
return (char*)data; return (char*)data;
} }
@ -1553,8 +1553,8 @@ __xputsnarf(char *data)
if(strlen(data) >= SnarfSize) if(strlen(data) >= SnarfSize)
return; return;
qlock(&clip.lk);
xlock(); xlock();
qlock(&clip.lk);
w = _x.windows; w = _x.windows;
strcpy(clip.buf, data); strcpy(clip.buf, data);
/* leave note for mouse proc to assert selection ownership */ /* leave note for mouse proc to assert selection ownership */
@ -1568,8 +1568,8 @@ __xputsnarf(char *data)
e.button = ~0; e.button = ~0;
XSendEvent(_x.display, w->drawable, True, ButtonPressMask, (XEvent*)&e); XSendEvent(_x.display, w->drawable, True, ButtonPressMask, (XEvent*)&e);
XFlush(_x.display); XFlush(_x.display);
xunlock();
qunlock(&clip.lk); qunlock(&clip.lk);
xunlock();
} }
static int static int