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>bb10
parent
43c28aa904
commit
2de7f4f771
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue