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 3, 2018
1 parent 4f8c9e1 commit 5c855b417f62a686080738db69053a7dcb159ceb
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() );

1 comment on commit 5c855b4

@nirvn

This comment has been minimized.

Copy link
Contributor

@nirvn nirvn commented on 5c855b4 Jul 7, 2018

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

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