From 3aaf34b677ad3841d6e0f541399b866e23f30b61 Mon Sep 17 00:00:00 2001 From: Luna Lovecraft Date: Thu, 10 Sep 2026 22:18:13 +0400 Subject: [PATCH] Fix a crash in the color space browser on qt 6.11 Some of the color space data includes a few NaNs, which when transformed it leads to insane values, which makes the qpainter crash in the newer qt version. So now there are a few NaN checks to avoid that. --- libs/ui/widgets/kis_cie_tongue_widget.cpp | 24 +++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/libs/ui/widgets/kis_cie_tongue_widget.cpp b/libs/ui/widgets/kis_cie_tongue_widget.cpp index f83066bea85..e7fb6a835e1 100644 --- a/libs/ui/widgets/kis_cie_tongue_widget.cpp +++ b/libs/ui/widgets/kis_cie_tongue_widget.cpp @@ -178,6 +178,12 @@ void KisCIETongueWidget::setProfileData(QVector p, QVector w, d->profileDataAvailable = profileData; if (profileData){ d->Primaries= p; + + for (int i = 0; i < d->Primaries.size(); i++) { + if (std::isnan(d->Primaries[i])) { + d->Primaries[i] = 0; + } + } d->whitePoint = w; d->needUpdatePixmap = true; @@ -193,7 +199,13 @@ void KisCIETongueWidget::setRGBData(QVector whitepoint, QVector Primaries= colorants; - + + for (int i = 0; i < d->Primaries.size(); i++) { + if (std::isnan(d->Primaries[i])) { + d->Primaries[i] = 0; + } + } + d->whitePoint = whitepoint; d->needUpdatePixmap = true; d->colorModel = KisCIETongueWidget::RGBA; @@ -543,14 +555,14 @@ void KisCIETongueWidget::drawGamut() gamutPaint.drawPath(path); gamutPaint.setOpacity(1.0); foreach (QPointF Point, d->gamut) { + if (std::isnan(Point.x()) || std::isnan(Point.y())) { + continue; + } mapPoint(x, y, Point); - gamutPaint.drawEllipse(x + d->xBias- 2, y-2, 4, 4); - //Point.setX(x); - //Point.setY(y); - //path.lineTo(Point); + gamutPaint.drawEllipse(x + d->xBias - 2, y - 2, 4, 4); } } - + gamutPaint.end(); d->painter.save(); d->painter.setOpacity(0.5); -- GitLab