Skip to content

Commit

Permalink
[ArcGIS REST] Also protect mCache.clear() by mutex
Browse files Browse the repository at this point in the history
  • Loading branch information
manisandro committed Nov 22, 2017
1 parent 9ed2636 commit e9309ee
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/providers/arcgisrest/qgsafsprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ QgsRectangle QgsAfsProvider::extent() const

void QgsAfsProvider::reloadData()
{
mSharedData->mCache.clear();
mSharedData->clearCache();
}


Expand Down
8 changes: 7 additions & 1 deletion src/providers/arcgisrest/qgsafsshareddata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,15 @@
#include "qgsarcgisrestutils.h"
#include "qgslogger.h"

void QgsAfsSharedData::clearCache()
{
QMutexLocker locker( &mMutex );
mCache.clear();
}

bool QgsAfsSharedData::getFeature( QgsFeatureId id, QgsFeature &f, bool fetchGeometry, const QList<int> & /*fetchAttributes*/, const QgsRectangle &filterRect )
{
QMutexLocker locker(&mMutex);
QMutexLocker locker( &mMutex );

// If cached, return cached feature
QMap<QgsFeatureId, QgsFeature>::const_iterator it = mCache.constFind( id );
Expand Down
1 change: 1 addition & 0 deletions src/providers/arcgisrest/qgsafsshareddata.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class QgsAfsSharedData : public QObject
const QgsFields &fields() const { return mFields; }
QgsRectangle extent() const { return mExtent; }
QgsCoordinateReferenceSystem crs() const { return mSourceCRS; }
void clearCache();

bool getFeature( QgsFeatureId id, QgsFeature &f, bool fetchGeometry, const QList<int> &fetchAttributes, const QgsRectangle &filterRect = QgsRectangle() );

Expand Down

0 comments on commit e9309ee

Please sign in to comment.