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
  • Loading branch information
m-kuhn authored and nirvn committed Jul 6, 2018
1 parent 4f8c9e1 commit 5c855b417f62a686080738db69053a7dcb159ceb
Showing 1 changed file with 22 additions and 0 deletions.
@@ -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() );

1 comment on commit 5c855b4

@nirvn
Copy link
Contributor

@nirvn nirvn commented on 5c855b4 Jul 7, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@m-kuhn , before I forget: we need to backport this to 3.2.

Please sign in to comment.