forward port of patch from master to fix crash due to non-existing theme
This commit is contained in:
parent
6be0228694
commit
55d6c78c9a
@ -125,18 +125,22 @@ bool ThemePrivate::useCache()
|
|||||||
cacheSize = config.themeCacheKb();
|
cacheSize = config.themeCacheKb();
|
||||||
}
|
}
|
||||||
const bool isRegularTheme = themeName != systemColorsTheme;
|
const bool isRegularTheme = themeName != systemColorsTheme;
|
||||||
QString cacheFile = "plasma_theme_" + themeName;
|
const QString cacheFile = "plasma_theme_" + themeName;
|
||||||
|
|
||||||
if (isRegularTheme) {
|
if (isRegularTheme) {
|
||||||
|
const QString cacheFileBase = cacheFile + "*.kcache";
|
||||||
|
|
||||||
const QString path = QStandardPaths::locate(QStandardPaths::GenericDataLocation, "desktoptheme/" + themeName + "/metadata.desktop");
|
const QString path = QStandardPaths::locate(QStandardPaths::GenericDataLocation, "desktoptheme/" + themeName + "/metadata.desktop");
|
||||||
|
QString currentCacheFileName;
|
||||||
|
if (!path.isEmpty()) {
|
||||||
const KPluginInfo pluginInfo(path);
|
const KPluginInfo pluginInfo(path);
|
||||||
|
currentCacheFileName = cacheFile + "_v" + pluginInfo.version() + ".kcache";
|
||||||
|
}
|
||||||
|
|
||||||
// now we check for, and remove if necessary, old caches
|
// now we check for, and remove if necessary, old caches
|
||||||
const QString cacheFileBase = cacheFile + "*.kcache";
|
|
||||||
cacheFile += "_v" + pluginInfo.version();
|
|
||||||
const QString currentCacheFileName = cacheFile + ".kcache";
|
|
||||||
foreach (const QString &file, QStandardPaths::locateAll(QStandardPaths::CacheLocation, cacheFileBase)) {
|
foreach (const QString &file, QStandardPaths::locateAll(QStandardPaths::CacheLocation, cacheFileBase)) {
|
||||||
if (!file.endsWith(currentCacheFileName)) {
|
if (currentCacheFileName.isEmpty() ||
|
||||||
|
!file.endsWith(currentCacheFileName)) {
|
||||||
QFile::remove(file);
|
QFile::remove(file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user