Skip to content
Permalink
Browse files
Protect point and line pattern symbol layer from eating too much memory
  • Loading branch information
mhugent committed Feb 21, 2013
1 parent eea57cf commit b54c75cef75f15a4edaf0dca6cc3bc793f980177
Showing with 14 additions and 0 deletions.
  1. +14 −0 src/core/symbology-ng/qgsfillsymbollayerv2.cpp
@@ -747,6 +747,13 @@ void QgsLinePatternFillSymbolLayer::startRender( QgsSymbolV2RenderContext& conte
int dx = 0;
int dy = 0;

if ( width > 10000 || height > 10000 ) //protect symbol layer from eating too much memory
{
QImage img;
mBrush.setTextureImage( img );
return;
}

QImage patternImage( width, height, QImage::Format_ARGB32 );
patternImage.fill( 0 );
QPainter p( &patternImage );
@@ -1049,6 +1056,13 @@ void QgsPointPatternFillSymbolLayer::startRender( QgsSymbolV2RenderContext& cont
double width = context.outputPixelSize( mDistanceX ) * 2.0;
double height = context.outputPixelSize( mDistanceY ) * 2.0;

if ( width > 10000 || height > 10000 ) //protect symbol layer from eating too much memory
{
QImage img;
mBrush.setTextureImage( img );
return;
}

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

2 comments on commit b54c75c

@gioman

This comment has been minimized.

Copy link
Contributor

@gioman gioman replied Feb 21, 2013

@mhugent

This comment has been minimized.

Copy link
Contributor Author

@mhugent mhugent replied Feb 21, 2013

Please sign in to comment.