File 0002-KisFileIconCreator-add-workaround-for-JPEG-XL-too.patch of Package paint

From c12b77a6a6941fabc750a590159c7f9d98776ee4 Mon Sep 17 00:00:00 2001
From: "Rasyuqa A. H." <qampidh@gmail.com>
Date: Sat, 6 Jan 2024 02:50:10 +0700
Subject: [PATCH 2/3] KisFileIconCreator: add workaround for JPEG XL too

KImageFormats / QImage can crash if we update libjxl to >= 0.9.0 due to API changes.
On Krita, this can result in crash whenever the thumbnail loads in welcome screen.

This patch also enables thumbnail generation for JXL as well.

(cherry picked from commit 1da5a7a6c2b2be5ec5e04c39a9a8663696d2b367)
---
 libs/ui/utils/KisFileIconCreator.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libs/ui/utils/KisFileIconCreator.cpp b/libs/ui/utils/KisFileIconCreator.cpp
index 17d0e482301a..25dd82d1fb09 100644
--- a/libs/ui/utils/KisFileIconCreator.cpp
+++ b/libs/ui/utils/KisFileIconCreator.cpp
@@ -112,8 +112,9 @@ bool KisFileIconCreator::createFileIcon(QString path, QIcon &icon, qreal deviceP
             } else {
                 return false;
             }
-        } else if (mimeType == "image/tiff" || mimeType == "image/x-tiff") {
+        } else if (mimeType == "image/tiff" || mimeType == "image/x-tiff" || mimeType == "image/jxl") {
             // Workaround for a bug in Qt tiff QImageIO plugin
+            // XXX: Also for JPEG-XL if KImageFormats haven't updated to accomodate libjxl >= v0.9.0 API changes.
             QScopedPointer<KisDocument> doc(KisPart::instance()->createTemporaryDocument());
             doc->setFileBatchMode(true);
             bool r = doc->openPath(path, KisDocument::DontAddToRecent);
-- 
2.43.0

openSUSE Build Service is sponsored by