mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
fix crash on quit
git-svn-id: http://svn.osgeo.org/qgis/trunk@14926 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
7e748f978b
commit
b49a6c8243
@ -102,19 +102,19 @@ void QgsMapLayerRegistry::removeMapLayer( QString theLayerId, bool theEmitSignal
|
||||
void QgsMapLayerRegistry::removeAllMapLayers()
|
||||
{
|
||||
// moved before physically removing the layers
|
||||
emit removedAll(); // now let all canvas Observers know to clear
|
||||
// themselves, and then consequently any of
|
||||
// their map legends
|
||||
emit removedAll();
|
||||
|
||||
QMap<QString, QgsMapLayer *>::iterator it;
|
||||
for ( it = mMapLayers.begin(); it != mMapLayers.end() ; ++it )
|
||||
// now let all canvas observers know to clear themselves,
|
||||
// and then consequently any of their map legends
|
||||
while ( mMapLayers.size() > 0 )
|
||||
{
|
||||
emit layerWillBeRemoved( it.key() );
|
||||
delete it.value(); // delete the map layer
|
||||
mMapLayers.remove( it.key() );
|
||||
QString id = mMapLayers.begin().key();
|
||||
emit layerWillBeRemoved( id );
|
||||
delete mMapLayers[ id ]; // delete the map layer
|
||||
mMapLayers.remove( id );
|
||||
}
|
||||
mMapLayers.clear();
|
||||
|
||||
mMapLayers.clear();
|
||||
} // QgsMapLayerRegistry::removeAllMapLayers()
|
||||
|
||||
//Added in QGIS 1.4
|
||||
|
Loading…
x
Reference in New Issue
Block a user