Skip to content
Permalink
Browse files

Fix a crash in layer node after removal of layer from registry.

A crash may occur when using custom layer tree in composer legend and layer from that tree is removed from registry.
This would happen only in some code paths.
  • Loading branch information
wonder-sk committed Nov 6, 2014
1 parent 878230a commit b1b0db6b7bdef10dcf6189db0b60d0176629bb99
Showing with 3 additions and 2 deletions.
  1. +3 −2 src/core/layertree/qgslayertreelayer.cpp
@@ -23,10 +23,11 @@
QgsLayerTreeLayer::QgsLayerTreeLayer( QgsMapLayer *layer )
: QgsLayerTreeNode( NodeLayer )
, mLayerId( layer->id() )
, mLayer( layer )
, mLayer( 0 )
, mVisible( Qt::Checked )
{
Q_ASSERT( QgsMapLayerRegistry::instance()->mapLayer( mLayerId ) == layer );
attachToLayer();
}

QgsLayerTreeLayer::QgsLayerTreeLayer( QString layerId, QString name )
@@ -148,8 +149,8 @@ void QgsLayerTreeLayer::registryLayersAdded( QList<QgsMapLayer*> layers )
{
if ( l->id() == mLayerId )
{
mLayer = l;
disconnect( QgsMapLayerRegistry::instance(), SIGNAL( layersAdded( QList<QgsMapLayer*> ) ), this, SLOT( registryLayersAdded( QList<QgsMapLayer*> ) ) );
attachToLayer();
emit layerLoaded();
break;
}

0 comments on commit b1b0db6

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