Skip to content

Commit

Permalink
Fix a crash in layer node after removal of layer from registry.
Browse files Browse the repository at this point in the history
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 7, 2014
1 parent 2597100 commit a54c31d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/core/layertree/qgslayertreelayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit a54c31d

Please sign in to comment.