Avoid potential detach on range-loops with non-const Qt containers
Seen by clazy range-loop
This commit is contained in:
parent
a73ac63ace
commit
53a2960353
@ -219,7 +219,8 @@ bool ThemePrivate::useCache()
|
||||
QDir cacheDir(QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation));
|
||||
cacheDir.setNameFilters(QStringList({cacheFileBase}));
|
||||
|
||||
for (const QFileInfo &file : cacheDir.entryInfoList()) {
|
||||
const auto files = cacheDir.entryInfoList();
|
||||
for (const QFileInfo &file : files) {
|
||||
if (currentCacheFileName.isEmpty() ||
|
||||
!file.absoluteFilePath().endsWith(currentCacheFileName)) {
|
||||
QFile::remove(file.absoluteFilePath());
|
||||
@ -268,7 +269,8 @@ bool ThemePrivate::useCache()
|
||||
QDir cacheDir(QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation));
|
||||
cacheDir.setNameFilters(QStringList({svgElementsFileNameBase + QLatin1Char('*')}));
|
||||
|
||||
for (const QFileInfo &file : cacheDir.entryInfoList()) {
|
||||
const auto files = cacheDir.entryInfoList();
|
||||
for (const QFileInfo &file : files) {
|
||||
if (!file.absoluteFilePath().endsWith(svgElementsFileName)) {
|
||||
QFile::remove(file.absoluteFilePath());
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user