From cd4ab21dd84f9093cd28cf922005893c6c432ef2 Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Mon, 28 Jun 2021 16:55:19 +0200 Subject: [PATCH] No need to check that a file exists if we know it's modified date --- src/plasma/svg.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/plasma/svg.cpp b/src/plasma/svg.cpp index 361d72d86..3edd32e19 100644 --- a/src/plasma/svg.cpp +++ b/src/plasma/svg.cpp @@ -457,9 +457,10 @@ bool SvgPrivate::setImagePath(const QString &imagePath) #endif } - QFileInfo info(path); + const QFileInfo info(path); + const QDateTime lastModifiedDate = info.lastModified(); - lastModified = info.lastModified().toSecsSinceEpoch(); + lastModified = lastModifiedDate.toSecsSinceEpoch(); SvgRectsCache::instance()->loadImageFromCache(path, lastModified); @@ -468,7 +469,7 @@ bool SvgPrivate::setImagePath(const QString &imagePath) // also images with absolute path needs to have a natural size initialized, // even if looks a bit weird using Theme to store non-themed stuff - if ((themed && !path.isEmpty() && QFileInfo::exists(path)) || QFileInfo::exists(actualPath)) { + if ((themed && !path.isEmpty() && lastModifiedDate.isValid()) || QFileInfo::exists(actualPath)) { naturalSize = SvgRectsCache::instance()->naturalSize(path, scaleFactor); if (naturalSize.isEmpty()) { createRenderer();