external/skia/UnpackedTarball_skia.mk | 1 external/skia/fix-xputimage-depth.patch.1 | 47 ++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+)
New commits: commit 7d110626be0d4e71cd91659bb38a730da94d6132 Author: Māris Nartišs <[email protected]> AuthorDate: Wed Feb 18 21:03:54 2026 +0200 Commit: Xisco Fauli <[email protected]> CommitDate: Tue Feb 24 12:25:23 2026 +0100 tdf#168138 skia: fix XPutImage BadMatch on 32-bit X11 windows RasterWindowContext_xlib::onSwapBuffers() hardcoded image.depth=24, but LibreOffice's BestVisual() prefers 32-bit TrueColor visuals when available, making window drawables depth=32. XPutImage requires XImage.depth to exactly match the target drawable's depth, so a mismatch causes an asynchronous X11 BadMatch error and crash at the next X11 call. Fix by querying the actual window depth via XGetWindowAttributes in the constructor and using it instead of the hardcoded 24. Change-Id: I202a350ed1159e8322c00821df2c6c5e7391382b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199648 Reviewed-by: Xisco Fauli <[email protected]> Tested-by: Jenkins Signed-off-by: Xisco Fauli <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199852 diff --git a/external/skia/UnpackedTarball_skia.mk b/external/skia/UnpackedTarball_skia.mk index 692eba0130e5..55a3056577e5 100644 --- a/external/skia/UnpackedTarball_skia.mk +++ b/external/skia/UnpackedTarball_skia.mk @@ -44,6 +44,7 @@ skia_patches := \ 0004-loong64-Fix-the-remaining-implicit-vector-casts.patch \ msvc-unknown-attributes.patch.1 \ fix-semaphore-include.patch.1 \ + fix-xputimage-depth.patch.1 \ ifneq ($(MSYSTEM),) # use binary flag so patch from git-bash won't choke on mixed line-endings in patches diff --git a/external/skia/fix-xputimage-depth.patch.1 b/external/skia/fix-xputimage-depth.patch.1 new file mode 100644 index 000000000000..0250af76bd70 --- /dev/null +++ b/external/skia/fix-xputimage-depth.patch.1 @@ -0,0 +1,47 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: LibreOffice +Date: Wed, 18 Feb 2026 00:00:00 +0000 +Subject: [PATCH] Fix XPutImage BadMatch on 32-bit X11 windows + +RasterWindowContext_xlib::onSwapBuffers() hardcoded image.depth = 24, +but the target X11 window may have depth 32 (when BestVisual() selects +a 32-bit TrueColor visual, which is preferred for compositing). +XPutImage requires image.depth to exactly match the drawable's depth; +mismatched depth results in a BadMatch X11 error. + +Fix: query the actual window depth once during construction via +XGetWindowAttributes and store it as fDepth, then use fDepth instead of +the hardcoded 24 in onSwapBuffers. +--- + tools/window/unix/RasterWindowContext_unix.cpp | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +--- skia.org/tools/window/unix/RasterWindowContext_unix.cpp ++++ skia/tools/window/unix/RasterWindowContext_unix.cpp +@@ -34,6 +34,7 @@ + Display* fDisplay; + XWindow fWindow; + GC fGC; ++ int fDepth; + }; + + RasterWindowContext_xlib::RasterWindowContext_xlib(Display* display, +@@ -43,6 +44,9 @@ + std::unique_ptr<const DisplayParams> params) + : RasterWindowContext(std::move(params)), fDisplay(display), fWindow(window) { + fGC = XCreateGC(fDisplay, fWindow, 0, nullptr); ++ XWindowAttributes attrs; ++ XGetWindowAttributes(fDisplay, fWindow, &attrs); ++ fDepth = attrs.depth; + this->resize(width, height); + fWidth = width; + fHeight = height; +@@ -79,7 +83,7 @@ + image.bitmap_unit = bitsPerPixel; + image.bitmap_bit_order = LSBFirst; + image.bitmap_pad = bitsPerPixel; +- image.depth = 24; ++ image.depth = fDepth; + image.bytes_per_line = pm.rowBytes() - pm.width() * pm.info().bytesPerPixel(); + image.bits_per_pixel = bitsPerPixel; + if (!XInitImage(&image)) {
