summaryrefslogtreecommitdiff
path: root/src/xcb_out.c
diff options
context:
space:
mode:
authorThomas Anderson <thomasanderson@google.com>2020-12-02 00:25:42 +0000
committerThomas Anderson <thomasanderson@google.com>2021-09-30 23:32:35 +0000
commit233d7b7f1f03ef18bf3955eb1f20421e745d22f0 (patch)
tree831f37e3bacb262e673d03cd9cbcdb44ebeb710c /src/xcb_out.c
parentdc2811874729ee83fa2aef110f60808c450f9a5a (diff)
Fix hang in xcb_request_check()
This fixes https://gitlab.freedesktop.org/xorg/lib/libxcb/-/issues/53 The issue was that libxcb expected to get a reply based on the request_expected variable, but a reply would never arrive because the request was never actually written. To resolve this, a separate request_expected_written variable is added.
Diffstat (limited to 'src/xcb_out.c')
-rw-r--r--src/xcb_out.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/xcb_out.c b/src/xcb_out.c
index df94867..8ffc03f 100644
--- a/src/xcb_out.c
+++ b/src/xcb_out.c
@@ -447,6 +447,7 @@ int _xcb_out_init(_xcb_out *out)
out->request = 0;
out->request_written = 0;
+ out->request_expected_written = 0;
if(pthread_mutex_init(&out->reqlenlock, 0))
return 0;
@@ -467,6 +468,7 @@ int _xcb_out_send(xcb_connection_t *c, struct iovec *vector, int count)
while(ret && count)
ret = _xcb_conn_wait(c, &c->out.cond, &vector, &count);
c->out.request_written = c->out.request;
+ c->out.request_expected_written = c->in.request_expected;
pthread_cond_broadcast(&c->out.cond);
_xcb_in_wake_up_next_reader(c);
return ret;