Skip to content
Permalink
Browse files

fixed newly introduced segfault on removing layers from legend (#2073)

git-svn-id: http://svn.osgeo.org/qgis/trunk@12059 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder
wonder committed Nov 9, 2009
1 parent 0a9324b commit edf0e520450a4e2bb96b78649b989baa385faae6
Showing with 5 additions and 10 deletions.
  1. +2 −7 src/app/legend/qgslegend.cpp
  2. +1 −1 src/app/legend/qgslegend.h
  3. +1 −1 src/app/legend/qgslegendlayer.cpp
  4. +1 −1 src/app/qgisapp.cpp
@@ -583,15 +583,15 @@ void QgsLegend::legendGroupRemove()
while ( child )
{
setCurrentItem( child );
legendLayerRemove();
removeCurrentLayer();
child = lg->child( 0 );
}
delete lg;
adjustIconSize();
}
}

void QgsLegend::legendLayerRemove()
void QgsLegend::removeCurrentLayer()
{
if ( !mMapCanvas || mMapCanvas->isDrawing() )
{
@@ -605,12 +605,7 @@ void QgsLegend::legendLayerRemove()

removeLayer( ll->layer(), true );

mStateOfCheckBoxes.erase( ll );
removeItem( ll );
delete ll;

adjustIconSize();

}

bool QgsLegend::removeLayer( QgsMapLayer* ml, bool askCancelOnEditable )
@@ -210,7 +210,7 @@ class QgsLegend : public QTreeWidget
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
@@ -376,7 +376,7 @@ void QgsLegendLayer::addToPopupMenu( QMenu& theMenu, QAction* toggleEditingActio

// remove from canvas
theMenu.addAction( QgisApp::getThemeIcon( "/mActionRemove.png" ),
tr( "&Remove" ), legend(), SLOT( legendLayerRemove() ) );
tr( "&Remove" ), legend(), SLOT( removeCurrentLayer() ) );

theMenu.addSeparator();

@@ -4769,7 +4769,7 @@ void QgisApp::isInOverview()

void QgisApp::removeLayer()
{
mMapLegend->legendLayerRemove();
mMapLegend->removeCurrentLayer();
// notify the project we've made a change
QgsProject::instance()->dirty( true );
}

0 comments on commit edf0e52

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