Skip to content

Commit

Permalink
postgres provider: only record active iterator, when it's open (fixes…
Browse files Browse the repository at this point in the history
… 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.
2 changes: 1 addition & 1 deletion src/core/qgspallabeling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion src/core/qgsvectorlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1057,7 +1057,6 @@ bool QgsVectorLayer::draw( QgsRenderContext& rendererContext )
bool labeling = false;
prepareLabelingAndDiagrams( rendererContext, attributes, labeling );


try
{
QgsFeatureIterator fit = getFeatures( QgsFeatureRequest()
Expand Down
3 changes: 2 additions & 1 deletion src/providers/postgres/qgspostgresfeatureiterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );

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

P->mActiveIterator = this;

mFetched = 0;
}

Expand Down

0 comments on commit bb0b978

Please sign in to comment.