[QGIS Commit] r12059 - in trunk/qgis/src/app: . legend

svn_qgis at osgeo.org svn_qgis at osgeo.org
Mon Nov 9 11:20:04 EST 2009


Author: wonder
Date: 2009-11-09 11:20:02 -0500 (Mon, 09 Nov 2009)
New Revision: 12059

Modified:
   trunk/qgis/src/app/legend/qgslegend.cpp
   trunk/qgis/src/app/legend/qgslegend.h
   trunk/qgis/src/app/legend/qgslegendlayer.cpp
   trunk/qgis/src/app/qgisapp.cpp
Log:
fixed newly introduced segfault on removing layers from legend (#2073)


Modified: trunk/qgis/src/app/legend/qgslegend.cpp
===================================================================
--- trunk/qgis/src/app/legend/qgslegend.cpp	2009-11-09 15:40:48 UTC (rev 12058)
+++ trunk/qgis/src/app/legend/qgslegend.cpp	2009-11-09 16:20:02 UTC (rev 12059)
@@ -583,7 +583,7 @@
     while ( child )
     {
       setCurrentItem( child );
-      legendLayerRemove();
+      removeCurrentLayer();
       child = lg->child( 0 );
     }
     delete lg;
@@ -591,7 +591,7 @@
   }
 }
 
-void QgsLegend::legendLayerRemove()
+void QgsLegend::removeCurrentLayer()
 {
   if ( !mMapCanvas || mMapCanvas->isDrawing() )
   {
@@ -605,12 +605,7 @@
 
   removeLayer( ll->layer(), true );
 
-  mStateOfCheckBoxes.erase( ll );
-  removeItem( ll );
-  delete ll;
-
   adjustIconSize();
-
 }
 
 bool QgsLegend::removeLayer( QgsMapLayer* ml, bool askCancelOnEditable )

Modified: trunk/qgis/src/app/legend/qgslegend.h
===================================================================
--- trunk/qgis/src/app/legend/qgslegend.h	2009-11-09 15:40:48 UTC (rev 12058)
+++ trunk/qgis/src/app/legend/qgslegend.h	2009-11-09 16:20:02 UTC (rev 12059)
@@ -210,7 +210,7 @@
     void writeProject( QDomDocument & );
 
     /**Removes the current LegendLayer*/
-    void legendLayerRemove();
+    void removeCurrentLayer();
 
     /**Removes a layer. If the layer is editable, a dialog is shown where user can select 'save', 'discard' and optionally 'cancel'. Cancel
       is useful if a single layer is removed whereas on closing of the whole project or application, the cancel option may not be possible

Modified: trunk/qgis/src/app/legend/qgslegendlayer.cpp
===================================================================
--- trunk/qgis/src/app/legend/qgslegendlayer.cpp	2009-11-09 15:40:48 UTC (rev 12058)
+++ trunk/qgis/src/app/legend/qgslegendlayer.cpp	2009-11-09 16:20:02 UTC (rev 12059)
@@ -376,7 +376,7 @@
 
   // remove from canvas
   theMenu.addAction( QgisApp::getThemeIcon( "/mActionRemove.png" ),
-                     tr( "&Remove" ), legend(), SLOT( legendLayerRemove() ) );
+                     tr( "&Remove" ), legend(), SLOT( removeCurrentLayer() ) );
 
   theMenu.addSeparator();
 

Modified: trunk/qgis/src/app/qgisapp.cpp
===================================================================
--- trunk/qgis/src/app/qgisapp.cpp	2009-11-09 15:40:48 UTC (rev 12058)
+++ trunk/qgis/src/app/qgisapp.cpp	2009-11-09 16:20:02 UTC (rev 12059)
@@ -4769,7 +4769,7 @@
 
 void QgisApp::removeLayer()
 {
-  mMapLegend->legendLayerRemove();
+  mMapLegend->removeCurrentLayer();
   // notify the project we've made a change
   QgsProject::instance()->dirty( true );
 }



More information about the QGIS-commit mailing list