Skip to content
Permalink
Browse files

Pass the full ogr data source URI as connInfo in qgsConnectionPool_Co…

…nnectionCreate.

This fixes corrupt rendering when loading the same dataset twice with different options (i.e. layers), see issue #14560.
  • Loading branch information
manisandro committed Apr 26, 2016
1 parent 2ba252b commit 79493ea39492030f638a416ece71fdb104198a89
@@ -35,7 +35,8 @@ inline QString qgsConnectionPool_ConnectionToName( QgsOgrConn* c )
inline void qgsConnectionPool_ConnectionCreate( QString connInfo, QgsOgrConn*& c )
{
c = new QgsOgrConn;
c->ds = OGROpen( connInfo.toUtf8().constData(), false, nullptr );
QString filePath = connInfo.left( connInfo.indexOf( "|" ) );
c->ds = OGROpen( filePath.toUtf8().constData(), false, nullptr );
c->path = connInfo;
c->valid = true;
}
@@ -44,7 +44,7 @@ QgsOgrFeatureIterator::QgsOgrFeatureIterator( QgsOgrFeatureSource* source, bool
{
mFeatureFetched = false;

mConn = QgsOgrConnPool::instance()->acquireConnection( mSource->mFilePath );
mConn = QgsOgrConnPool::instance()->acquireConnection( mSource->mProvider->dataSourceUri() );

if ( mSource->mLayerName.isNull() )
{
@@ -348,20 +348,20 @@ bool QgsOgrFeatureIterator::readFeature( OGRFeatureH fet, QgsFeature& feature )
QgsOgrFeatureSource::QgsOgrFeatureSource( const QgsOgrProvider* p )
: mProvider( p )
{
mFilePath = p->filePath();
mDataSource = p->dataSourceUri();
mLayerName = p->layerName();
mLayerIndex = p->layerIndex();
mSubsetString = p->mSubsetString;
mEncoding = p->mEncoding; // no copying - this is a borrowed pointer from Qt
mFields = p->mAttributeFields;
mDriverName = p->ogrDriverName;
mOgrGeometryTypeFilter = wkbFlatten( p->mOgrGeometryTypeFilter );
QgsOgrConnPool::instance()->ref( mFilePath );
QgsOgrConnPool::instance()->ref( mDataSource );
}

QgsOgrFeatureSource::~QgsOgrFeatureSource()
{
QgsOgrConnPool::instance()->unref( mFilePath );
QgsOgrConnPool::instance()->unref( mDataSource );
}

QgsFeatureIterator QgsOgrFeatureSource::getFeatures( const QgsFeatureRequest& request )
@@ -34,7 +34,7 @@ class QgsOgrFeatureSource : public QgsAbstractFeatureSource

protected:
const QgsOgrProvider* mProvider;
QString mFilePath;
QString mDataSource;
QString mLayerName;
int mLayerIndex;
QString mSubsetString;

2 comments on commit 79493ea

@nyalldawson

This comment has been minimized.

Copy link
Collaborator

@nyalldawson nyalldawson replied Apr 29, 2016

@manisandro can this be backported for the 2.14.2 release? (due today!)

@manisandro

This comment has been minimized.

Copy link
Member Author

@manisandro manisandro replied Apr 29, 2016

@nyalldawson Done (hope still on time)

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