File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -40,5 +40,11 @@ const QDomDocument* QgsCapabilitiesCache::searchCapabilitiesDocument( const QStr
40
40
41
41
void QgsCapabilitiesCache::insertCapabilitiesDocument ( const QString& configFilePath, const QDomDocument* doc )
42
42
{
43
+ if ( mCachedCapabilities .size () > 40 )
44
+ {
45
+ // remove another cache entry to avoid memory problems
46
+ QHash<QString, QDomDocument>::iterator capIt = mCachedCapabilities .begin ();
47
+ mCachedCapabilities .erase ( capIt );
48
+ }
43
49
mCachedCapabilities .insert ( configFilePath, doc->cloneNode ().toDocument () );
44
50
}
Original file line number Diff line number Diff line change @@ -61,12 +61,9 @@ QgsConfigParser* QgsConfigCache::insertConfiguration( const QString& filePath )
61
61
{
62
62
if ( mCachedConfigurations .size () > 40 )
63
63
{
64
- // remove 10 elements to avoid memory problems
64
+ // remove a cache entry to avoid memory problems
65
65
QHash<QString, QgsConfigParser*>::iterator configIt = mCachedConfigurations .begin ();
66
- for ( int i = 0 ; i < 10 ; ++i )
67
- {
68
- configIt = mCachedConfigurations .erase ( configIt );
69
- }
66
+ mCachedConfigurations .erase ( configIt );
70
67
}
71
68
72
69
// first open file
You can’t perform that action at this time.
0 commit comments