Skip to content
Permalink
Browse files

Merge pull request #5692 from manisandro/afsshareddata_mutex

[ArcGIS REST] Add missing mutex to QgsAfsProvider (fixes #17513)
  • Loading branch information
manisandro committed Nov 22, 2017
2 parents db3c93c + e9309ee commit d6d4097036911544600e71ec83a852415e4e1bb3
@@ -199,7 +199,7 @@ QgsRectangle QgsAfsProvider::extent() const

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


@@ -17,8 +17,16 @@
#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 );

// If cached, return cached feature
QMap<QgsFeatureId, QgsFeature>::const_iterator it = mCache.constFind( id );
if ( it != mCache.constEnd() )
@@ -17,6 +17,7 @@
#define QGSAFSSHAREDDATA_H

#include <QObject>
#include <QMutex>
#include "qgsfields.h"
#include "qgsfeature.h"
#include "qgsdatasourceuri.h"
@@ -33,11 +34,13 @@ 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() );

private:
friend class QgsAfsProvider;
QMutex mMutex;
QgsDataSourceUri mDataSource;
QgsRectangle mExtent;
QgsWkbTypes::Type mGeometryType = QgsWkbTypes::Unknown;

0 comments on commit d6d4097

Please sign in to comment.
You can’t perform that action at this time.