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:
David Edmundson 2014-12-11 01:56:55 +01:00
parent 901cc3e159
commit f6aa18c884
2 changed files with 3 additions and 4 deletions

View File

@ -115,6 +115,7 @@ ThemePrivate::ThemePrivate(QObject *parent)
ThemePrivate::~ThemePrivate()
{
saveSvgElementsCache();
if (FrameSvgPrivate::s_sharedFrames.contains(this)) {
foreach (FrameData *data, FrameSvgPrivate::s_sharedFrames[this].values()) {
delete data;

View File

@ -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);