Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fixed newly introduced segfault on removing layers from legend (#2073)
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@12059 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder committed Nov 9, 2009
1 parent dc1e2b2 commit a7e5b92
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 10 deletions.
9 changes: 2 additions & 7 deletions src/app/legend/qgslegend.cpp
Expand Up @@ -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() )
{
Expand All @@ -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 )
Expand Down
2 changes: 1 addition & 1 deletion src/app/legend/qgslegend.h
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/app/legend/qgslegendlayer.cpp
Expand Up @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion src/app/qgisapp.cpp
Expand Up @@ -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 );
}
Expand Down

0 comments on commit a7e5b92

Please sign in to comment.