Blame SOURCES/0001-Fix-XTS-regression-in-XCopyColormapAndFree.patch

f20033
From a515545065ce6e1924de4bc50aaae7ec9b48cfad Mon Sep 17 00:00:00 2001
f20033
From: Adam Jackson <ajax@redhat.com>
f20033
Date: Wed, 11 Dec 2019 11:53:11 -0500
f20033
Subject: [PATCH libX11] Fix XTS regression in XCopyColormapAndFree
f20033
MIME-Version: 1.0
f20033
Content-Type: text/plain; charset=UTF-8
f20033
Content-Transfer-Encoding: 8bit
f20033
f20033
XCopyColormapAndFree/5 threw an assertion:
f20033
f20033
    520|4 5 00014017 1 2|Assertion XCopyColormapAndFree-5.(A)
f20033
    520|4 5 00014017 1 3|When a colourmap argument does not name a valid colourmap,
f20033
    520|4 5 00014017 1 4|then a BadColor error occurs.
f20033
    520|4 5 00014017 1 5|METH: Create a bad colourmap by creating and freeing a colourmap.
f20033
    520|4 5 00014017 1 6|METH: Call test function using bad colourmap as the colourmap argument.
f20033
    520|4 5 00014017 1 7|METH: Verify that a BadColor error occurs.
f20033
    520|4 5 00014017 1 8|unexpected signal 6 (SIGABRT) received
f20033
    220|4 5 2 15:05:53|UNRESOLVED
f20033
    410|4 5 1 15:05:53|IC End
f20033
    510|4|system 0: Abandoning testset: caught unexpected signal 11 (SIGSEGV)
f20033
f20033
More specifically:
f20033
f20033
    lt-XCopyColormapAndFree: xcb_io.c:533: _XAllocID: Assertion `ret != inval_id' failed.
f20033
f20033
This bug was introduced (by following my advice, d'oh) in:
f20033
f20033
    commit 99a2cf1aa0b58391078d5d3edf0a7dab18c7745d
f20033
    Author: Tapani Pälli <tapani.palli@intel.com>
f20033
    Date:   Mon May 13 08:29:49 2019 +0300
f20033
f20033
        Protect colormap add/removal with display lock
f20033
f20033
In that patch we moved the call to _XcmsCopyCmapRecAndFree inside the
f20033
display lock. The problem is said routine has side effects, including
f20033
trying to implicitly create a colormap in some cases. Since we don't run
f20033
the XID handler until SyncHandle() we would see inconsistent internal
f20033
xlib state, triggering the above assert.
f20033
f20033
Fix this by dropping and re-taking the display lock before calling into
f20033
XCMS.
f20033
---
f20033
 src/CopyCmap.c | 5 +++++
f20033
 1 file changed, 5 insertions(+)
f20033
f20033
diff --git a/src/CopyCmap.c b/src/CopyCmap.c
f20033
index b4954b01..b37aba73 100644
f20033
--- a/src/CopyCmap.c
f20033
+++ b/src/CopyCmap.c
f20033
@@ -53,6 +53,11 @@ Colormap XCopyColormapAndFree(
f20033
     mid = req->mid = XAllocID(dpy);
f20033
     req->srcCmap = src_cmap;
f20033
 
f20033
+    /* re-lock the display to keep XID handling in sync */
f20033
+    UnlockDisplay(dpy);
f20033
+    SyncHandle();
f20033
+    LockDisplay(dpy);
f20033
+
f20033
 #if XCMS
f20033
     _XcmsCopyCmapRecAndFree(dpy, src_cmap, mid);
f20033
 #endif
f20033
-- 
f20033
2.23.0
f20033