Save SVGs only when a theme is unloaded, not on each theme proxy
A single Plasma theme will be represented by one ThemePrivate object, which is exported in multiple Theme objects. We want to save the cache when that theme stops being used, not each time an item stops using the theme. saveSvgElementsCache calls sync() which involves a lot of parsing and IO. This makes everything a lot faster at no cost. Change-Id: Ica6ba0273bc99fb8ad8733a1c90db8f1e87c49ea
This commit is contained in:
parent
901cc3e159
commit
f6aa18c884
@ -115,7 +115,8 @@ ThemePrivate::ThemePrivate(QObject *parent)
|
||||
|
||||
ThemePrivate::~ThemePrivate()
|
||||
{
|
||||
if (FrameSvgPrivate::s_sharedFrames.contains(this)) {
|
||||
saveSvgElementsCache();
|
||||
if (FrameSvgPrivate::s_sharedFrames.contains(this)) {
|
||||
foreach (FrameData *data, FrameSvgPrivate::s_sharedFrames[this].values()) {
|
||||
delete data;
|
||||
}
|
||||
@ -633,7 +634,7 @@ QColor ThemePrivate::color(Theme::ColorRole role, Theme::ColorGroup group) const
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
switch (role) {
|
||||
|
@ -91,8 +91,6 @@ Theme::Theme(const QString &themeName, QObject *parent)
|
||||
|
||||
Theme::~Theme()
|
||||
{
|
||||
d->saveSvgElementsCache();
|
||||
|
||||
if (d == ThemePrivate::globalTheme) {
|
||||
if (!ThemePrivate::globalThemeRefCount.deref()) {
|
||||
disconnect(ThemePrivate::globalTheme, 0, this, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user