Skip to content
Permalink
Browse files

Fix #11455 (Crash when setting transparency for WMS layer)

Layer transparency instance was not copied when renderers were cloned.
  • Loading branch information
wonder-sk committed Oct 22, 2014
1 parent 6db04b4 commit c9e05f9800d11811f95ec1b2c9cc1881b13667d6
@@ -57,7 +57,7 @@ QgsRasterInterface * QgsMultiBandColorRenderer::clone() const
}
renderer->setOpacity( mOpacity );
renderer->setAlphaBand( mAlphaBand );
renderer->setRasterTransparency( mRasterTransparency );
renderer->setRasterTransparency( new QgsRasterTransparency( *mRasterTransparency ) );

return renderer;
}
@@ -51,7 +51,7 @@ QgsRasterInterface * QgsPalettedRasterRenderer::clone() const
QgsPalettedRasterRenderer * renderer = new QgsPalettedRasterRenderer( 0, mBand, rgbArray(), mNColors );
renderer->setOpacity( mOpacity );
renderer->setAlphaBand( mAlphaBand );
renderer->setRasterTransparency( mRasterTransparency );
renderer->setRasterTransparency( new QgsRasterTransparency( *mRasterTransparency ) );
renderer->mLabels = mLabels;
return renderer;
}
@@ -16,6 +16,7 @@
***************************************************************************/

#include "qgssinglebandcolordatarenderer.h"
#include "qgsrastertransparency.h"
#include "qgsrasterviewport.h"
#include <QDomDocument>
#include <QDomElement>
@@ -36,7 +37,7 @@ QgsRasterInterface * QgsSingleBandColorDataRenderer::clone() const
QgsSingleBandColorDataRenderer * renderer = new QgsSingleBandColorDataRenderer( 0, mBand );
renderer->setOpacity( mOpacity );
renderer->setAlphaBand( mAlphaBand );
renderer->setRasterTransparency( mRasterTransparency );
renderer->setRasterTransparency( new QgsRasterTransparency( *mRasterTransparency ) );
return renderer;
}

@@ -37,7 +37,7 @@ QgsRasterInterface * QgsSingleBandGrayRenderer::clone() const
QgsSingleBandGrayRenderer * renderer = new QgsSingleBandGrayRenderer( 0, mGrayBand );
renderer->setOpacity( mOpacity );
renderer->setAlphaBand( mAlphaBand );
renderer->setRasterTransparency( mRasterTransparency );
renderer->setRasterTransparency( new QgsRasterTransparency( *mRasterTransparency ) );
renderer->setGradient( mGradient );
if ( mContrastEnhancement )
{
@@ -63,7 +63,7 @@ QgsRasterInterface * QgsSingleBandPseudoColorRenderer::clone() const

renderer->setOpacity( mOpacity );
renderer->setAlphaBand( mAlphaBand );
renderer->setRasterTransparency( mRasterTransparency );
renderer->setRasterTransparency( new QgsRasterTransparency( *mRasterTransparency ) );

return renderer;
}

3 comments on commit c9e05f9

@nyalldawson

This comment has been minimized.

Copy link
Collaborator

@nyalldawson nyalldawson replied Oct 23, 2014

@wonder-sk This change has introduced a ton of crashes - you can see them if you try and run the test suite, or at http://dash.orfeo-toolbox.org/viewTest.php?onlyfailed&buildid=161197 . I think in some cases mRasterTransparency is not set, so the copy constructor causes a segfault.

@wonder-sk

This comment has been minimized.

Copy link
Member Author

@wonder-sk wonder-sk replied Oct 23, 2014

D'oh what a shameful "fix" - going to fix it... thanks for pointing it out

@nyalldawson

This comment has been minimized.

Copy link
Collaborator

@nyalldawson nyalldawson replied Oct 23, 2014

@wonder-sk don't worry, you're excused... 2600CHF to go and we won't have to check this anymore! ;)

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