Skip to content

Commit

Permalink
VLCache takes ownership of index
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn authored and Matthias Kuhn committed May 20, 2014
1 parent 73d69f2 commit edbfb57
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/core/qgsvectorlayercache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ QgsVectorLayerCache::QgsVectorLayerCache( QgsVectorLayer* layer, int cacheSize,
connect( mLayer, SIGNAL( attributeValueChanged( QgsFeatureId, int, const QVariant& ) ), SLOT( onAttributeValueChanged( QgsFeatureId, int, const QVariant& ) ) );
}

QgsVectorLayerCache::~QgsVectorLayerCache()
{
qDeleteAll( mCacheIndices );
mCacheIndices.clear();
}

void QgsVectorLayerCache::setCacheSize( int cacheSize )
{
mCache.setMaxCost( cacheSize );
Expand Down Expand Up @@ -178,7 +184,7 @@ void QgsVectorLayerCache::requestCompleted( QgsFeatureRequest featureRequest, Qg

void QgsVectorLayerCache::featureRemoved( QgsFeatureId fid )
{
foreach ( QgsAbstractCacheIndex* idx, mCacheIndices )
Q_FOREACH( QgsAbstractCacheIndex* idx, mCacheIndices )
{
idx->flushFeature( fid );
}
Expand Down
4 changes: 4 additions & 0 deletions src/core/qgsvectorlayercache.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ class CORE_EXPORT QgsVectorLayerCache : public QObject
*
* @param cacheSize indicates the maximum number of features to keep in the cache
*/

~QgsVectorLayerCache();

void setCacheSize( int cacheSize );

/**
Expand Down Expand Up @@ -136,6 +139,7 @@ class CORE_EXPORT QgsVectorLayerCache : public QObject
* @brief
* Adds a {@link QgsAbstractCacheIndex} to this cache. Cache indices know about features present
* in this cache and decide, if enough information is present in the cache to respond to a {@link QgsFeatureRequest}.
* The layer cache will take ownership of the index.
*
* @param cacheIndex The cache index to add.
*/
Expand Down

0 comments on commit edbfb57

Please sign in to comment.