From d9a79c9381ec2bd8b787edc3c72a7b96b84917d5 Mon Sep 17 00:00:00 2001 From: rldhont Date: Fri, 10 Jun 2016 15:27:03 +0200 Subject: [PATCH] [BUGFIX] Emit layerWillBeRemoved like layersWillBeRemoved (#3194) The signal layerWillBeremoved is only emitted when the layer is owned by QgsMapLayerRegistry. To fix it just move the emitted layerWilBeRemoved out of the scope of layers owned by QgsMapLayerRegistry. --- src/core/qgsmaplayerregistry.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/qgsmaplayerregistry.cpp b/src/core/qgsmaplayerregistry.cpp index 93f4fb535a3..9fd6b6f9322 100644 --- a/src/core/qgsmaplayerregistry.cpp +++ b/src/core/qgsmaplayerregistry.cpp @@ -144,10 +144,10 @@ void QgsMapLayerRegistry::removeMapLayers( const QList& layers ) continue; QString myId( lyr->id() ); + emit layerWillBeRemoved( myId ); + emit layerWillBeRemoved( lyr ); if ( mOwnedLayers.contains( lyr ) ) { - emit layerWillBeRemoved( myId ); - emit layerWillBeRemoved( lyr ); delete lyr; mOwnedLayers.remove( lyr ); }