Avoid adding null-objects to the icon cache
When we can't get the icon for the first time, we would use the data in the cache later, and we will never get the new icon when the system theme is updated while the application is running. Pick-to: 6.1 Change-Id: I839ad9983918561a1dc6bc842f85477bba53f64a Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
parent
3458dd2d47
commit
4dc7102c84
@ -1323,9 +1323,9 @@ QIcon QIcon::fromTheme(const QString &name)
|
||||
bool hasUserTheme = QIconLoader::instance()->hasUserTheme();
|
||||
QIconEngine * const engine = (platformTheme && !hasUserTheme) ? platformTheme->createIconEngine(name)
|
||||
: new QIconLoaderEngine(name);
|
||||
QIcon *cachedIcon = new QIcon(engine);
|
||||
icon = *cachedIcon;
|
||||
qtIconCache()->insert(name, cachedIcon);
|
||||
icon = QIcon(engine);
|
||||
if (!icon.isNull())
|
||||
qtIconCache()->insert(name, new QIcon(icon));
|
||||
}
|
||||
|
||||
return icon;
|
||||
|
Loading…
x
Reference in New Issue
Block a user