Skip to content

Commit ff6fd80

Browse files
m-kuhnnyalldawson
authored andcommittedJul 10, 2018
fix crasher when rendering a symbol layer subsequent to
rendering a geometry generator layer Fixes #19121 https://issues.qgis.org/issues/19121 (cherry-picked from 5c855b4)
1 parent a488291 commit ff6fd80

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
 

‎src/core/symbology/qgssymbol.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -688,6 +688,27 @@ class ExpressionContextScopePopper
688688

689689
QgsExpressionContext *context = nullptr;
690690
};
691+
692+
/**
693+
* RAII class to restore original geometry on a render context on destruction
694+
*/
695+
class GeometryRestorer
696+
{
697+
public:
698+
GeometryRestorer( QgsRenderContext &context )
699+
: mContext( context ),
700+
mGeometry( context.geometry() )
701+
{}
702+
703+
~GeometryRestorer()
704+
{
705+
mContext.setGeometry( mGeometry );
706+
}
707+
708+
private:
709+
QgsRenderContext &mContext;
710+
const QgsAbstractGeometry *mGeometry;
711+
};
691712
///@endcond PRIVATE
692713

693714
void QgsSymbol::renderFeature( const QgsFeature &feature, QgsRenderContext &context, int layer, bool selected, bool drawVertexMarker, int currentVertexMarkerType, int currentVertexMarkerSize )
@@ -698,6 +719,7 @@ void QgsSymbol::renderFeature( const QgsFeature &feature, QgsRenderContext &cont
698719
return;
699720
}
700721

722+
GeometryRestorer geomRestorer( context );
701723
QgsGeometry segmentizedGeometry = geom;
702724
bool usingSegmentizedGeometry = false;
703725
context.setGeometry( geom.constGet() );

0 commit comments

Comments
 (0)
Please sign in to comment.