summaryrefslogtreecommitdiffstats
path: root/src/gui/image
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2021-02-25 12:21:48 +0100
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2021-02-25 16:08:44 +0100
commit2de7f4f771dc0b903374c213201d5334f1a9316b (patch)
tree469005ef2d919ded0f2ca706530114d2220add50 /src/gui/image
parent43c28aa9046967abeb4ad042c8be1aa23a19c282 (diff)
QIcon::setIsMask: don't dereference nullptr
QIcon::detach might result in the d pointer being nullptr, and other code tests for that condition and allocates the d pointer explicitly. Change the order of the tests in setIsMask as well, fix static analzyer warning 0a4723ca2d216ec8883a3d412aeded4c. Pick-to: 6.1 Change-Id: Idca12f230036362f13cbaee1ae4f0e5ce6726015 Reviewed-by: David Skoland <david.skoland@qt.io> Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Diffstat (limited to 'src/gui/image')
-rw-r--r--src/gui/image/qicon.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp
index 4f31414e10..d3fe8791b7 100644
--- a/src/gui/image/qicon.cpp
+++ b/src/gui/image/qicon.cpp
@@ -1377,10 +1377,10 @@ bool QIcon::hasThemeIcon(const QString &name)
*/
void QIcon::setIsMask(bool isMask)
{
+ if (d)
+ detach();
if (!d)
d = new QIconPrivate(new QPixmapIconEngine);
- else
- detach();
d->is_mask = isMask;
}