From 5eece6769f21ad7006269934a1f21f705147f71b Mon Sep 17 00:00:00 2001 From: Randy Kron Date: Sat, 20 Jan 2018 22:21:07 +0000 Subject: [PATCH] Fix one source of log spam referenced in Bug 388389 (Empty filename passed to function) Summary: I found two places in plasma-framework svg.cpp (Plasma::Svg) that were triggering this message. path variable was not being checked for empty before passing to QFile::exists(). This seems to be one source of the issue reported in [[ https://bugs.kde.org/show_bug.cgi?id=388389 | Bug 388389 ]] Test Plan: Found that kicker was triggering this message and also plasmashell tooltips. Reviewers: #frameworks, davidedmundson Reviewed By: davidedmundson Subscribers: ngraham, alexeymin, aacid, #frameworks Tags: #frameworks Differential Revision: https://phabricator.kde.org/D9928 --- src/plasma/svg.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plasma/svg.cpp b/src/plasma/svg.cpp index ad87ca46e..06da0171a 100644 --- a/src/plasma/svg.cpp +++ b/src/plasma/svg.cpp @@ -237,7 +237,7 @@ bool SvgPrivate::setImagePath(const QString &imagePath) path = actualTheme()->imagePath(themePath); themeFailed = path.isEmpty(); QObject::connect(actualTheme(), SIGNAL(themeChanged()), q, SLOT(themeChanged())); - } else if (QFile::exists(actualPath)) { + } else if (QFileInfo::exists(actualPath)) { QObject::connect(cacheAndColorsTheme(), SIGNAL(themeChanged()), q, SLOT(themeChanged()), Qt::UniqueConnection); path = actualPath; } else { @@ -251,7 +251,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 && QFile::exists(path)) || QFile::exists(actualPath)) { + if ((themed && !path.isEmpty() && QFileInfo::exists(path)) || QFileInfo::exists(actualPath)) { QRectF rect; if (cacheAndColorsTheme()->findInRectsCache(path, QStringLiteral("_Natural_%1").arg(scaleFactor), rect)) { @@ -900,7 +900,7 @@ bool Svg::isValid() const return true; } - if (!QFile::exists(d->path)) { + if (d->path.isEmpty() || !QFileInfo::exists(d->path)) { return false; }