Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 10, 2018
1 parent a488291 commit ff6fd80
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/core/symbology/qgssymbol.cpp
Expand Up @@ -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 )
Expand All @@ -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() );
Expand Down

0 comments on commit ff6fd80

Please sign in to comment.