Skip to content
Permalink
Browse files
Merge pull request #4504 from nyalldawson/project_cleanup
Cleanup project closing
  • Loading branch information
nyalldawson committed May 6, 2017
2 parents 0a0c33d + fe67704 commit 27ab5a0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 12 deletions.
@@ -4768,8 +4768,6 @@ void QgisApp::fileNew( bool promptToSaveFlag, bool forceBlank )
closeProject();

QgsProject *prj = QgsProject::instance();
prj->clear();

prj->layerTreeRegistryBridge()->setNewLayersVisible( settings.value( QStringLiteral( "qgis/new_layers_visible" ), true ).toBool() );

//set the color for selections
@@ -8737,11 +8735,6 @@ void QgisApp::removingLayers( const QStringList &layers )
}
}

void QgisApp::removeAllLayers()
{
QgsProject::instance()->removeAllMapLayers();
}

void QgisApp::removeLayer()
{
if ( !mLayerTreeView )
@@ -10032,7 +10025,7 @@ void QgisApp::closeProject()
mMapCanvas->clearCache();
mOverviewCanvas->setLayers( QList<QgsMapLayer *>() );
mMapCanvas->freeze( false );
removeAllLayers();
QgsProject::instance()->clear();
}


@@ -206,8 +206,6 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow

//! Set the extents of the map canvas
void setExtent( const QgsRectangle &rect );
//! Remove all layers from the map and legend - reimplements same method from qgisappbase
void removeAllLayers();

/** Open a raster or vector file; ignore other files.
Used to process a commandline argument, FileOpen or Drop event.
@@ -348,12 +348,11 @@ QgsProject::QgsProject( QObject *parent )

QgsProject::~QgsProject()
{
clear();
delete mBadLayerHandler;
delete mRelationManager;
delete mLayerTreeRegistryBridge;
delete mRootGroup;

removeAllMapLayers();
}


@@ -487,6 +486,7 @@ void QgsProject::clear()
writeEntry( QStringLiteral( "Measurement" ), QStringLiteral( "/DistanceUnits" ), s.value( QStringLiteral( "/qgis/measure/displayunits" ) ).toString() );
writeEntry( QStringLiteral( "Measurement" ), QStringLiteral( "/AreaUnits" ), s.value( QStringLiteral( "/qgis/measure/areaunits" ) ).toString() );

removeAllMapLayers();
setDirty( false );
}

0 comments on commit 27ab5a0

Please sign in to comment.