cleanup the pixmaps before app exit, otherwise they can leak into x
svn path=/trunk/KDE/kdelibs/; revision=1099009
This commit is contained in:
parent
841200fe6a
commit
5ed6f6d546
17
theme.cpp
17
theme.cpp
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user