From ba28ca60f66c83a1caa5777d78ffac63e92dfec3 Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Thu, 15 May 2014 13:09:31 +0200 Subject: Fix compilation on libxcb 1.5 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit libxkbcommon-x11 uses xcb_discard_reply() function which was introduced in libxcb 1.6, this brakes the compilation in src/3rdparty/xkbcommon/src/x11/util.c when linking with libxcb 1.5 : linking ../../../../plugins/platforms/libqxcb.so .obj/util.o: In function `adopt_atoms': util.c:(.text+0x347): undefined reference to `xcb_discard_reply' collect2: error: ld returned 1 exit status We can use an alternative approach to discard uncollected replies and in addition add a fix for out-of-bounds error [1] [1] https://github.com/xkbcommon/libxkbcommon/commit/e3f751be660e28e48d1477660e99e5456c864296 Task-number: QTBUG-38952 Change-Id: Ide90f9a2e75fc79d2bab0b81adb282c8cc81c345 Reviewed-by: Jørgen Lind --- .../xkbcommon/Fix-compilation-on-libxcb-1.5.patch | 19 +++++++++++++++++++ src/3rdparty/xkbcommon/src/x11/util.c | 8 ++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 src/3rdparty/xkbcommon/Fix-compilation-on-libxcb-1.5.patch (limited to 'src/3rdparty/xkbcommon') diff --git a/src/3rdparty/xkbcommon/Fix-compilation-on-libxcb-1.5.patch b/src/3rdparty/xkbcommon/Fix-compilation-on-libxcb-1.5.patch new file mode 100644 index 0000000000..691f142e5e --- /dev/null +++ b/src/3rdparty/xkbcommon/Fix-compilation-on-libxcb-1.5.patch @@ -0,0 +1,19 @@ +diff --git a/src/3rdparty/xkbcommon/src/x11/util.c b/src/3rdparty/xkbcommon/src/x11/util.c +index 92ff2e6..7659c71 100644 +--- a/src/3rdparty/xkbcommon/src/x11/util.c ++++ b/src/3rdparty/xkbcommon/src/x11/util.c +@@ -198,8 +198,12 @@ adopt_atoms(struct xkb_context *ctx, xcb_connection_t *conn, + * sit there waiting. Sad. + */ + err_discard: +- for (size_t j = i + 1; j < stop; j++) +- xcb_discard_reply(conn, cookies[j].sequence); ++ for (size_t j = i + 1; j < stop; j++) { ++ if (from[j] != XCB_ATOM_NONE) { ++ reply = xcb_get_atom_name_reply(conn, cookies[j % SIZE], NULL); ++ free(reply); ++ } ++ } + return false; + } + } diff --git a/src/3rdparty/xkbcommon/src/x11/util.c b/src/3rdparty/xkbcommon/src/x11/util.c index 92ff2e630e..7659c711a2 100644 --- a/src/3rdparty/xkbcommon/src/x11/util.c +++ b/src/3rdparty/xkbcommon/src/x11/util.c @@ -198,8 +198,12 @@ adopt_atoms(struct xkb_context *ctx, xcb_connection_t *conn, * sit there waiting. Sad. */ err_discard: - for (size_t j = i + 1; j < stop; j++) - xcb_discard_reply(conn, cookies[j].sequence); + for (size_t j = i + 1; j < stop; j++) { + if (from[j] != XCB_ATOM_NONE) { + reply = xcb_get_atom_name_reply(conn, cookies[j % SIZE], NULL); + free(reply); + } + } return false; } } -- cgit v1.2.3