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 bb0b978
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
@@ -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.