* 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:
parent
7cfce67821
commit
f4486e8862
1
svg.cpp
1
svg.cpp
@ -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;
|
||||
|
10
theme.cpp
10
theme.cpp
@ -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
13
theme.h
@ -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:
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user