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));
|
QDir cacheDir(QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation));
|
||||||
cacheDir.setNameFilters(QStringList({cacheFileBase}));
|
cacheDir.setNameFilters(QStringList({cacheFileBase}));
|
||||||
|
|
||||||
for (const QFileInfo &file : cacheDir.entryInfoList()) {
|
const auto files = cacheDir.entryInfoList();
|
||||||
|
for (const QFileInfo &file : files) {
|
||||||
if (currentCacheFileName.isEmpty() ||
|
if (currentCacheFileName.isEmpty() ||
|
||||||
!file.absoluteFilePath().endsWith(currentCacheFileName)) {
|
!file.absoluteFilePath().endsWith(currentCacheFileName)) {
|
||||||
QFile::remove(file.absoluteFilePath());
|
QFile::remove(file.absoluteFilePath());
|
||||||
@ -268,7 +269,8 @@ bool ThemePrivate::useCache()
|
|||||||
QDir cacheDir(QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation));
|
QDir cacheDir(QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation));
|
||||||
cacheDir.setNameFilters(QStringList({svgElementsFileNameBase + QLatin1Char('*')}));
|
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)) {
|
if (!file.absoluteFilePath().endsWith(svgElementsFileName)) {
|
||||||
QFile::remove(file.absoluteFilePath());
|
QFile::remove(file.absoluteFilePath());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user