Skip to content

Commit

Permalink
Fix freeze when loading point pattern fill with distance 0
Browse files Browse the repository at this point in the history
This results in a QImage with 0 extension which in turn is not acceptable
for the painter which in turn results in plenty of QPainter inactive messages
being thrown around.
  • Loading branch information
m-kuhn committed Nov 7, 2019
1 parent 845894b commit f214b2c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/core/symbology/qgsfillsymbollayer.cpp
Expand Up @@ -3183,7 +3183,11 @@ void QgsPointPatternFillSymbolLayer::applyPattern( const QgsSymbolRenderContext

QImage patternImage( width, height, QImage::Format_ARGB32 );
patternImage.fill( 0 );

if ( patternImage.isNull() )
{
brush.setTextureImage( QImage() );
return;
}
if ( mMarkerSymbol )
{
QPainter p( &patternImage );
Expand Down
3 changes: 1 addition & 2 deletions src/core/symbology/qgssymbol.cpp
Expand Up @@ -527,8 +527,7 @@ void QgsSymbol::drawPreviewIcon( QPainter *painter, QSize size, QgsRenderContext
context->setExpressionContext( expContext );
}

const auto constMLayers = mLayers;
for ( QgsSymbolLayer *layer : constMLayers )
for ( QgsSymbolLayer *layer : qgis::as_const( mLayers ) )
{
if ( !layer->enabled() || ( customContext && !customContext->isSymbolLayerEnabled( layer ) ) )
continue;
Expand Down

0 comments on commit f214b2c

Please sign in to comment.