Skip to content

Commit d310971

Browse files
authored
Merge pull request #5302 from boundlessgeo/issue_16803_DefaultIcon_to_avoid_segfault
set default legend raster icon when wms layer
2 parents 6321923 + b611916 commit d310971

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/core/layertree/qgslayertreemodel.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,12 @@ QVariant QgsLayerTreeModel::data( const QModelIndex &index, int role ) const
227227
if ( testFlag( ShowRasterPreviewIcon ) )
228228
{
229229
QgsRasterLayer* rlayer = qobject_cast<QgsRasterLayer *>( layer );
230+
// avoid to create preview for wms that imply a better multi thread management
231+
// due to async nature of wms.
232+
// The following two line of code is part of the fix of
233+
// https://issues.qgis.org/issues/16803
234+
if ( rlayer->providerType() == QLatin1String( "wms" ) )
235+
return QgsLayerItem::iconRaster();
230236
return QIcon( QPixmap::fromImage( rlayer->previewAsImage( QSize( 32, 32 ) ) ) );
231237
}
232238
else

0 commit comments

Comments
 (0)