summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2021-02-25 12:21:48 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-02-28 14:21:06 +0000
commitc286ad46656d4ebafbebdc5f82d1e2737956db40 (patch)
tree0e759d649e5044ce832c944bee372c2cc89ac38c /src/gui
parente904f5987292811d623d4d0b58fd6b011845ef8f (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. 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> (cherry picked from commit 2de7f4f771dc0b903374c213201d5334f1a9316b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/gui')
-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;
}