Skip to content

Commit 63ba802

Browse files
committed
Categorized renderer: fix memory leak
1 parent 6175f24 commit 63ba802

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/core/symbology-ng/qgscategorizedsymbolrendererv2.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ QgsCategorizedSymbolRendererV2::QgsCategorizedSymbolRendererV2( QString attrName
142142
mSourceColorRamp( NULL ),
143143
mInvertedColorRamp( false ),
144144
mScaleMethod( DEFAULT_SCALE_METHOD ),
145+
mExpression( 0 ),
145146
mRotationFieldIdx( -1 ),
146147
mSizeScaleFieldIdx( -1 )
147148
{
@@ -199,8 +200,9 @@ QgsSymbolV2* QgsCategorizedSymbolRendererV2::symbolForFeature( QgsFeature& featu
199200
{
200201
const QgsAttributes& attrs = feature.attributes();
201202
QVariant value;
202-
if ( mAttrNum < 0 || mAttrNum >= attrs.count() )
203+
if ( mAttrNum == -1 )
203204
{
205+
Q_ASSERT( mExpression );
204206
value = mExpression->evaluate( &feature );
205207
}
206208
else
@@ -406,6 +408,7 @@ void QgsCategorizedSymbolRendererV2::stopRender( QgsRenderContext& context )
406408
delete it2.value();
407409
}
408410
mTempSymbols.clear();
411+
delete mExpression;
409412
}
410413

411414
QList<QString> QgsCategorizedSymbolRendererV2::usedAttributes()

0 commit comments

Comments
 (0)