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

(cherry-picked from 0dfe687)
  • Loading branch information
nyalldawson committed May 9, 2017
1 parent 8309c3c commit a6883f7
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 4 deletions.
@@ -88,7 +88,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 )
@@ -46,7 +46,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;
@@ -354,7 +354,6 @@ bool QgsOgrFeatureIterator::readFeature( OGRFeatureH fet, QgsFeature& feature )


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

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

0 comments on commit a6883f7

Please sign in to comment.