Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #5302 from boundlessgeo/issue_16803_DefaultIcon_to…
…_avoid_segfault

set default legend raster icon when wms layer
  • Loading branch information
elpaso committed Oct 13, 2017
2 parents 6321923 + b611916 commit d310971
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/core/layertree/qgslayertreemodel.cpp
Expand Up @@ -227,6 +227,12 @@ QVariant QgsLayerTreeModel::data( const QModelIndex &index, int role ) const
if ( testFlag( ShowRasterPreviewIcon ) )
{
QgsRasterLayer* rlayer = qobject_cast<QgsRasterLayer *>( layer );
// avoid to create preview for wms that imply a better multi thread management
// due to async nature of wms.
// The following two line of code is part of the fix of
// https://issues.qgis.org/issues/16803
if ( rlayer->providerType() == QLatin1String( "wms" ) )
return QgsLayerItem::iconRaster();
return QIcon( QPixmap::fromImage( rlayer->previewAsImage( QSize( 32, 32 ) ) ) );
}
else
Expand Down

0 comments on commit d310971

Please sign in to comment.