cleanup the pixmaps before app exit, otherwise they can leak into x

svn path=/trunk/KDE/kdelibs/; revision=1099009
This commit is contained in:
Aaron J. Seigo 2010-03-04 22:28:39 +00:00
parent 841200fe6a
commit 5ed6f6d546
2 changed files with 18 additions and 0 deletions

View File

@ -128,6 +128,7 @@ public:
bool useCache();
void settingsFileChanged(const QString &);
void setThemeName(const QString &themeName, bool writeSettings);
void onAppExitCleanup();
static const char *defaultTheme;
static const char *themeRcFile;
@ -181,6 +182,14 @@ bool ThemePrivate::useCache()
return cacheTheme;
}
void ThemePrivate::onAppExitCleanup()
{
pixmapsToCache.clear();
delete pixmapCache;
pixmapCache = 0;
cacheTheme = false;
}
QString ThemePrivate::findInTheme(const QString &image, const QString &theme) const
{
//TODO: this should be using Package
@ -284,6 +293,10 @@ Theme::Theme(QObject *parent)
d(new ThemePrivate(this))
{
settingsChanged();
if (QCoreApplication::instance()) {
connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()),
this, SLOT(onAppExitCleanup()));
}
}
Theme::Theme(const QString &themeName, QObject *parent)
@ -295,6 +308,10 @@ Theme::Theme(const QString &themeName, QObject *parent)
d->cacheTheme = false;
setThemeName(themeName);
d->cacheTheme = useCache;
if (QCoreApplication::instance()) {
connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()),
this, SLOT(onAppExitCleanup()));
}
}
Theme::~Theme()

View File

@ -329,6 +329,7 @@ class PLASMA_EXPORT Theme : public QObject
Q_PRIVATE_SLOT(d, void colorsChanged())
Q_PRIVATE_SLOT(d, void settingsFileChanged(const QString &))
Q_PRIVATE_SLOT(d, void scheduledCacheUpdate())
Q_PRIVATE_SLOT(d, void onAppExitCleanup())
};
} // Plasma namespace