Skip to content
Permalink
Browse files
postgres provider: only record active iterator, when it's open (fixes…
… crash on labeling non-existing attributes)
  • Loading branch information
jef-n committed Feb 7, 2013
1 parent 7551aa7 commit bb0b97811949ac6095fe6a0804f2ef4fb4e97343
Showing with 3 additions and 3 deletions.
  1. +1 −1 src/core/qgspallabeling.cpp
  2. +0 −1 src/core/qgsvectorlayer.cpp
  3. +2 −1 src/providers/postgres/qgspostgresfeatureiterator.cpp
@@ -1165,7 +1165,7 @@ bool QgsPalLabeling::willUseLayer( QgsVectorLayer* layer )

int QgsPalLabeling::prepareLayer( QgsVectorLayer* layer, QSet<int>& attrIndices, QgsRenderContext& ctx )
{
QgsDebugMsg( "PREPARE LAYER" );
QgsDebugMsg( "PREPARE LAYER " + layer->id() );
Q_ASSERT( mMapRenderer != NULL );

// start with a temporary settings class, find out labeling info
@@ -1057,7 +1057,6 @@ bool QgsVectorLayer::draw( QgsRenderContext& rendererContext )
bool labeling = false;
prepareLabelingAndDiagrams( rendererContext, attributes, labeling );


try
{
QgsFeatureIterator fit = getFeatures( QgsFeatureRequest()
@@ -50,7 +50,6 @@ QgsPostgresFeatureIterator::QgsPostgresFeatureIterator( QgsPostgresProvider* p,
// make sure that only one iterator is active
if ( P->mActiveIterator )
P->mActiveIterator->close();
P->mActiveIterator = this;

mCursorName = QString( "qgisf%1" ).arg( P->mProviderId );

@@ -79,6 +78,8 @@ QgsPostgresFeatureIterator::QgsPostgresFeatureIterator( QgsPostgresProvider* p,
return;
}

P->mActiveIterator = this;

mFetched = 0;
}

0 comments on commit bb0b978

Please sign in to comment.