Skip to content
Permalink
Browse files
Fix crash when OGR layer is removed when source is stored
Remove link to provider in OGR feature source
  • Loading branch information
nyalldawson committed Apr 23, 2017
1 parent 6beaa51 commit 0dfe687361a8ecbde286b9c5ad378db4464cf762
Showing with 2 additions and 4 deletions.
  1. +1 −1 src/providers/ogr/qgsogrexpressioncompiler.cpp
  2. +1 −2 src/providers/ogr/qgsogrfeatureiterator.cpp
  3. +0 −1 src/providers/ogr/qgsogrfeatureiterator.h
@@ -86,7 +86,7 @@ QgsSqlExpressionCompiler::Result QgsOgrExpressionCompiler::compileNode( const Qg

QString QgsOgrExpressionCompiler::quotedIdentifier( const QString &identifier )
{
return mSource->mProvider->quotedIdentifier( identifier.toUtf8() );
return QgsOgrProviderUtils::quotedIdentifier( identifier.toUtf8(), mSource->mDriverName );
}

QString QgsOgrExpressionCompiler::quotedValue( const QVariant &value, bool &ok )
@@ -47,7 +47,7 @@ QgsOgrFeatureIterator::QgsOgrFeatureIterator( QgsOgrFeatureSource *source, bool
, mFilterFids( mRequest.filterFids() )
, mFilterFidsIt( mFilterFids.constBegin() )
{
mConn = QgsOgrConnPool::instance()->acquireConnection( mSource->mProvider->dataSourceUri() );
mConn = QgsOgrConnPool::instance()->acquireConnection( mSource->mDataSource );
if ( !mConn->ds )
{
return;
@@ -353,7 +353,6 @@ bool QgsOgrFeatureIterator::readFeature( OGRFeatureH fet, QgsFeature &feature )


QgsOgrFeatureSource::QgsOgrFeatureSource( const QgsOgrProvider *p )
: mProvider( p )
{
mDataSource = p->dataSourceUri();
mLayerName = p->layerName();
@@ -33,7 +33,6 @@ class QgsOgrFeatureSource : public QgsAbstractFeatureSource
virtual QgsFeatureIterator getFeatures( const QgsFeatureRequest &request ) override;

protected:
const QgsOgrProvider *mProvider = nullptr;
QString mDataSource;
QString mLayerName;
int mLayerIndex;

0 comments on commit 0dfe687

Please sign in to comment.