summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/image/qicon.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp
index 38e66b1dc0..08c4667c6c 100644
--- a/src/gui/image/qicon.cpp
+++ b/src/gui/image/qicon.cpp
@@ -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();