From 65144dba057d3c2d0541a160fc5daf2d020b5b12 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Thu, 1 Aug 2024 09:27:57 +0200 Subject: [PATCH] QIcon: don't detach in setIsMask if value doesn't change QQuickLabsPlatformIconLoader calls setIsMask on the icon to reflect the value from the Icon element, and usually that doesn't change the value. Detaching it anyway results in the icon no longer reusing the cached engine. Task-number: QTBUG-127614 Pick-to: 6.7 6.5 Change-Id: Iead04d8a8a2342b03858cf5f72b43c51d442dd6b Reviewed-by: Christian Ehrlicher (cherry picked from commit 55f41eb6732d5577eacaf181d5c092c3e15a2b4e) Reviewed-by: Qt Cherry-pick Bot --- src/gui/image/qicon.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp index 8ad7cc28b88..cb45ce98974 100644 --- a/src/gui/image/qicon.cpp +++ b/src/gui/image/qicon.cpp @@ -1834,6 +1834,9 @@ QIcon QIcon::fromTheme(QIcon::ThemeIcon icon, const QIcon &fallback) */ void QIcon::setIsMask(bool isMask) { + if (isMask == (d && d->is_mask)) + return; + detach(); if (!d) d = new QIconPrivate(new QPixmapIconEngine);