QIcon: remove icon from cache if the cached engine fails to load
An icon that is not null by the time it is inserted in the cache can become null, depending on the QIconEngine implementation. For example, when an application with a shortcut exists on the desktop, uninstall the application, and then install the application again, the acquisition of the application icon will fail. The reason is that after installing the application for the second time, the qtIconCache will not be updated when the icon is acquired. Done-with: Volker Hilsheimer <volker.hilsheimer@qt.io> Pick-to: 5.15 6.2 6.3 6.4 Change-Id: I6dc8cf435815b92da270d74fe992843336af23e2 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
parent
fb8832de9c
commit
9e7c567050
@ -1276,11 +1276,15 @@ void QIcon::setFallbackThemeName(const QString &name)
|
||||
*/
|
||||
QIcon QIcon::fromTheme(const QString &name)
|
||||
{
|
||||
QIcon icon;
|
||||
|
||||
if (qtIconCache()->contains(name)) {
|
||||
icon = *qtIconCache()->object(name);
|
||||
} else if (QDir::isAbsolutePath(name)) {
|
||||
if (QIcon *cachedIcon = qtIconCache()->object(name)) {
|
||||
if (!cachedIcon->isNull())
|
||||
return *cachedIcon;
|
||||
qtIconCache()->remove(name);
|
||||
}
|
||||
|
||||
QIcon icon;
|
||||
if (QDir::isAbsolutePath(name)) {
|
||||
return QIcon(name);
|
||||
} else {
|
||||
QPlatformTheme * const platformTheme = QGuiApplicationPrivate::platformTheme();
|
||||
|
Loading…
Reference in New Issue
Block a user