* remove in-memory entries for invalid elements when an svg is no longer in use

* remove in-memory entries for invalid elements when the rect cache is invalidated for an svg

svn path=/trunk/KDE/kdelibs/; revision=895570
This commit is contained in:
Aaron J. Seigo 2008-12-11 02:45:45 +00:00
parent 7cfce67821
commit f4486e8862
3 changed files with 23 additions and 1 deletions

View File

@ -257,6 +257,7 @@ class SvgPrivate
if (renderer && renderer.count() == 2) {
// this and the cache reference it; and boy is this not thread safe ;)
s_renderers.erase(s_renderers.find(path));
Plasma::Theme::defaultTheme()->releaseRectsCache(path);
}
renderer = 0;

View File

@ -611,6 +611,16 @@ void Theme::invalidateRectsCache(const QString& image)
{
KConfigGroup imageGroup(d->svgElementsCache, image);
imageGroup.deleteGroup();
releaseRectsCache(image);
}
void Theme::releaseRectsCache(const QString &image)
{
QHash<QString, QSet<QString> >::iterator it = d->invalidElements.find(image);
if (it != d->invalidElements.end()) {
d->invalidElements.erase(it);
}
}
void Theme::setCacheLimit(int kbytes)

13
theme.h
View File

@ -224,8 +224,19 @@ class PLASMA_EXPORT Theme : public QObject
/**
* Discards all the information about a given image from the rectangle disk cache
*
* @arg image the path to the image the cache is assoiated with
**/
void invalidateRectsCache(const QString& image);
void invalidateRectsCache(const QString &image);
/**
* Frees up memory used by cached information for a given image without removing
* the permenant record of it on disk.
* @see invalidateRectsCache
*
* @arg image the path to the image the cache is assoiated with
*/
void releaseRectsCache(const QString &image);
Q_SIGNALS:
/**