Merged update from upstream sources

This is an automated DistroBaker update from upstream sources.
If you do not know what this is about or would like to opt out,
contact the OSCI team.

Source: https://src.fedoraproject.org/rpms/libX11.git#233ab3808594b02fa65affba22b016ae5c825fd8
This commit is contained in:
DistroBaker 2020-11-30 23:37:47 +00:00
parent fff2bcd0b6
commit 1bf9f81682
3 changed files with 12 additions and 118 deletions

View File

@ -1,109 +0,0 @@
diff --git a/src/Xxcbint.h b/src/Xxcbint.h
index 4ef13d2f..d8293259 100644
--- a/src/Xxcbint.h
+++ b/src/Xxcbint.h
@@ -27,6 +27,7 @@ typedef struct _X11XCBPrivate {
PendingRequest *pending_requests;
PendingRequest *pending_requests_tail;
xcb_generic_event_t *next_event;
+ void *next_response;
char *real_bufmax;
char *reply_data;
int reply_length;
diff --git a/src/xcb_io.c b/src/xcb_io.c
index 0bd1fdf9..4be75408 100644
--- a/src/xcb_io.c
+++ b/src/xcb_io.c
@@ -282,22 +282,83 @@ static xcb_generic_reply_t *poll_for_event(Display *dpy, Bool queued_only)
static xcb_generic_reply_t *poll_for_response(Display *dpy)
{
void *response;
- xcb_generic_error_t *error;
+ xcb_generic_reply_t *event;
PendingRequest *req;
- while(!(response = poll_for_event(dpy, False)) &&
- (req = dpy->xcb->pending_requests) &&
- !req->reply_waiter)
+
+ while(1)
{
+ xcb_generic_error_t *error = NULL;
uint64_t request;
+ Bool poll_queued_only = dpy->xcb->next_response != NULL;
- if(!xcb_poll_for_reply64(dpy->xcb->connection, req->sequence,
- &response, &error)) {
- /* xcb_poll_for_reply64 may have read events even if
- * there is no reply. */
- response = poll_for_event(dpy, True);
+ /* Step 1: is there an event in our queue before the next
+ * reply/error? Return that first.
+ *
+ * If we don't have a reply/error saved from an earlier
+ * invocation we check incoming events too, otherwise only
+ * the ones already queued.
+ */
+ response = poll_for_event(dpy, poll_queued_only);
+ if(response)
break;
+
+ /* Step 2:
+ * Response is NULL, i.e. we have no events.
+ * If we are not waiting for a reply or some other thread
+ * had dibs on the next reply, exit.
+ */
+ req = dpy->xcb->pending_requests;
+ if(!req || req->reply_waiter)
+ break;
+
+ /* Step 3:
+ * We have some response (error or reply) related to req
+ * saved from an earlier invocation of this function. Let's
+ * use that one.
+ */
+ if(dpy->xcb->next_response)
+ {
+ if (((xcb_generic_reply_t*)dpy->xcb->next_response)->response_type == X_Error)
+ {
+ error = dpy->xcb->next_response;
+ response = NULL;
+ }
+ else
+ {
+ response = dpy->xcb->next_response;
+ error = NULL;
+ }
+ dpy->xcb->next_response = NULL;
+ }
+ else
+ {
+ /* Step 4: pull down the next response from the wire. This
+ * should be the 99% case.
+ * xcb_poll_for_reply64() may also pull down events that
+ * happened before the reply.
+ */
+ if(!xcb_poll_for_reply64(dpy->xcb->connection, req->sequence,
+ &response, &error)) {
+ /* if there is no reply/error, xcb_poll_for_reply64
+ * may have read events. Return that. */
+ response = poll_for_event(dpy, True);
+ break;
+ }
+
+ /* Step 5: we have a new response, but we may also have some
+ * events that happened before that response. Return those
+ * first and save our reply/error for the next invocation.
+ */
+ event = poll_for_event(dpy, True);
+ if(event)
+ {
+ dpy->xcb->next_response = error ? error : response;
+ response = event;
+ break;
+ }
}
+ /* Step 6: actually handle the reply/error now... */
request = X_DPY_GET_REQUEST(dpy);
if(XLIB_SEQUENCE_COMPARE(req->sequence, >, request))
{

View File

@ -4,8 +4,8 @@
Summary: Core X11 protocol client library
Name: libX11
Version: 1.6.12
Release: 3%{?gitdate:.%{gitdate}git%{gitversion}}%{?dist}
Version: 1.7.0
Release: 2%{?gitdate:.%{gitdate}git%{gitversion}}%{?dist}
License: MIT
URL: http://www.x.org
@ -18,8 +18,6 @@ Source0: https://xorg.freedesktop.org/archive/individual/lib/%{name}-%{version}.
%endif
Patch2: dont-forward-keycode-0.patch
# diff from https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/53
Patch3: libX11-race-condition.patch
BuildRequires: make
BuildRequires: xorg-x11-util-macros >= 1.11
@ -57,9 +55,7 @@ Conflicts: %{name} < %{version}-%{release}
libX11/libxcb interoperability library
%prep
%setup -q -n %{tarball}-%{?gitdate:%{gitdate}}%{!?gitdate:%{version}}
%patch2 -p1 -b .dont-forward-keycode-0
%patch3 -p1 -b .race-condition
%autosetup -p1 -n %{tarball}-%{?gitdate:%{gitdate}}%{!?gitdate:%{version}}
%build
autoreconf -v --install --force
@ -90,7 +86,7 @@ make %{?_smp_mflags} check
%files
%{_libdir}/libX11.so.6
%{_libdir}/libX11.so.6.3.0
%{_libdir}/libX11.so.6.4.0
%files xcb
%{_libdir}/libX11-xcb.so.1
@ -125,6 +121,13 @@ make %{?_smp_mflags} check
%{_mandir}/man5/*.5*
%changelog
* Tue Dec 01 2020 Peter Hutterer <peter.hutterer@redhat.com> 1.7.0-2
- libX11 1.7.0 (with the tarball this time)
* Tue Dec 01 2020 Peter Hutterer <peter.hutterer@redhat.com> 1.7.0-1
- libX11 1.7.0
- switch to using the autosetup rpm macro
* Mon Nov 09 2020 Peter Hutterer <peter.hutterer@redhat.com> 1.6.12-3
- Fix a race-condition in poll_for_response (#1758384)

View File

@ -1 +1 @@
SHA512 (libX11-1.6.12.tar.bz2) = 79df7d61d9009b0dd3b65f67a62189aa0a43799c01026b3d2d534092596a0b67f246af5e398a89eb1ccc61a27335f81be8262b8a39768a76f62d862cd7415a47
SHA512 (libX11-1.7.0.tar.bz2) = f661ca90350fd8a94f054b00f12f5122cea068ebff706acfd399462236c189a296a2358d17d16166635101cf56cc19303dd407873a159932d093c9f33556f9fb