diff options
author | Marc Mutz <[email protected]> | 2025-03-20 11:36:02 +0100 |
---|---|---|
committer | Marc Mutz <[email protected]> | 2025-03-20 23:00:52 +0100 |
commit | b291047a4de0c2632a3e23da66fae00ab69905aa (patch) | |
tree | 9ba91b223488eea3449467ab82a070daff8ee3af | |
parent | 8aab205d6d2f4082789e74d65585aea754b29e73 (diff) |
QGenericUnixTheme: de-pessimise xdgFileIcon()
Coverity complained about a missing std::move() on the return in L270,
but adding that would, of course, not help, because the QIcon object
being returned is const.
If NRVO would (at least theoretically) kick in, this would be
harmless, but NRVO can't kick in, because it's unknown at the time of
construction whether this will be the object that end up being
returned to the caller, so the compiler will have to copy the object
into the return value when that decision is made (post the isNull()
check).
By not making the object const, we enable it to be moved instead,
which is what Coverity originally wanted us to do.
Amends 46ea82188e3678c5b7a2338d536da6c621822f2f.
Coverity picked this up as a new issue following
53fb13456fffe8bfd192f9197c6d1703854b49a2, so there probably is another
CID for this for the same code in the old location, but my Coverity
search-foo is insufficient to find the corresponding CID, without
undue effort, so I didn't try.
Not picking back, as this is a "low impact" issue, according to
Coverity (and me).
Coverity-Id: 478087
Change-Id: I7f36cdbe83525a23ea0dfa27157091dbdf73a28b
Reviewed-by: Friedemann Kleint <[email protected]>
-rw-r--r-- | src/gui/platform/unix/qgenericunixtheme.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gui/platform/unix/qgenericunixtheme.cpp b/src/gui/platform/unix/qgenericunixtheme.cpp index 8becb1ab61c..d704a3541cc 100644 --- a/src/gui/platform/unix/qgenericunixtheme.cpp +++ b/src/gui/platform/unix/qgenericunixtheme.cpp @@ -265,7 +265,7 @@ QIcon QGenericUnixTheme::xdgFileIcon(const QFileInfo &fileInfo) return QIcon(); const QString &iconName = mimeType.iconName(); if (!iconName.isEmpty()) { - const QIcon icon = QIcon::fromTheme(iconName); + QIcon icon = QIcon::fromTheme(iconName); if (!icon.isNull()) return icon; } |