Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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.
2 changes: 1 addition & 1 deletion src/providers/ogr/qgsogrexpressioncompiler.cpp
Expand Up @@ -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 )
Expand Down
3 changes: 1 addition & 2 deletions src/providers/ogr/qgsogrfeatureiterator.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -354,7 +354,6 @@ bool QgsOgrFeatureIterator::readFeature( OGRFeatureH fet, QgsFeature& feature )


QgsOgrFeatureSource::QgsOgrFeatureSource( const QgsOgrProvider* p )
: mProvider( p )
{
mDataSource = p->dataSourceUri();
mLayerName = p->layerName();
Expand Down
1 change: 0 additions & 1 deletion src/providers/ogr/qgsogrfeatureiterator.h
Expand Up @@ -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;
Expand Down

0 comments on commit a6883f7

Please sign in to comment.