xorg-libxcb/src
Erik Kurzinger bbda345a71 don't flag extra reply in xcb_take_socket
If any flags are specified in a call to xcb_take_socket,
they should only be applied to replies for requests sent
after that function returns (and until the socket is
re-acquired by XCB).

Previously, they would also be incorrectly applied to the
reply for the last request sent before the socket was taken.
For instance, in this example program the reply for the
GetInputFocus request gets discarded, even though it was
sent before the socket was taken. This results in the
call to retrieve the reply hanging indefinitely.

static void return_socket(void *closure) {}

int main(void)
{
    Display *dpy = XOpenDisplay(NULL);
    xcb_connection_t *c = XGetXCBConnection(dpy);

    xcb_get_input_focus_cookie_t cookie = xcb_get_input_focus_unchecked(c);
    xcb_flush(c);

    uint64_t seq;
    xcb_take_socket(c, return_socket, dpy, XCB_REQUEST_DISCARD_REPLY, &seq);

    xcb_generic_error_t *err;
    xcb_get_input_focus_reply(c, cookie, &err);
}

In practice, this has been causing intermittent KWin crashes when
used in combination with the proprietary NVIDIA driver such as
https://bugs.kde.org/show_bug.cgi?id=386370 since when Xlib fails to
retrieve one of these incorrectly discarded replies it triggers
an IO error.

Signed-off-by: Erik Kurzinger <ekurzinger@nvidia.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-08-21 18:57:01 +02:00
..
man generated man pages: use xorg footer and no hard coded extension 2014-01-30 12:10:06 +09:00
.gitignore Add Present extension 2013-11-07 14:02:37 -08:00
c_client.py c_client: Add support for lists of FDs 2017-06-05 20:36:50 +01:00
Makefile.am optionally build the GE extension 2017-03-11 10:51:33 +01:00
xcb.h add support for eventstruct 2017-03-11 10:51:50 +01:00
xcb_auth.c Remove tabs and trailing whitespaces 2014-03-21 14:35:16 +01:00
xcb_conn.c xcb_get_setup(): Never return NULL 2014-08-25 19:15:34 -04:00
xcb_ext.c Always include "config.h" at the start of all C source files. 2012-08-25 12:34:24 -07:00
xcb_in.c don't flag extra reply in xcb_take_socket 2018-08-21 18:57:01 +02:00
xcb_list.c Define _xcb_map_new with explicit void arg list instead of empty one 2013-08-06 11:10:01 -07:00
xcb_out.c don't flag extra reply in xcb_take_socket 2018-08-21 18:57:01 +02:00
xcb_util.c Check strdup for NULL return value. 2017-04-01 11:50:09 +02:00
xcb_windefs.h Remove tabs and trailing whitespaces 2014-03-21 14:35:16 +01:00
xcb_xid.c Always include "config.h" at the start of all C source files. 2012-08-25 12:34:24 -07:00
xcbext.h Correct @param "e" to "error" in xcb_poll_for_reply*() 2016-05-29 15:56:25 +02:00
xcbint.h Fix a thread hang with xcb_wait_for_special_event() 2015-06-25 20:38:48 +02:00