Skip to content
Permalink
Browse files

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)
  • Loading branch information
m-kuhn authored and nyalldawson committed Jul 3, 2018
1 parent a488291 commit ff6fd80289f1f04b5964b99ab628dee1fa00d43e
Showing with 22 additions and 0 deletions.
  1. +22 −0 src/core/symbology/qgssymbol.cpp
@@ -688,6 +688,27 @@ class ExpressionContextScopePopper

QgsExpressionContext *context = nullptr;
};

/**
* RAII class to restore original geometry on a render context on destruction
*/
class GeometryRestorer
{
public:
GeometryRestorer( QgsRenderContext &context )
: mContext( context ),
mGeometry( context.geometry() )
{}

~GeometryRestorer()
{
mContext.setGeometry( mGeometry );
}

private:
QgsRenderContext &mContext;
const QgsAbstractGeometry *mGeometry;
};
///@endcond PRIVATE

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
return;
}

GeometryRestorer geomRestorer( context );
QgsGeometry segmentizedGeometry = geom;
bool usingSegmentizedGeometry = false;
context.setGeometry( geom.constGet() );

0 comments on commit ff6fd80

Please sign in to comment.
You can’t perform that action at this time.