Skip to content
Permalink
Browse files

Archive has to be cleared when clear() is called

  • Loading branch information
pblottiere committed Jul 11, 2017
1 parent 92bad92 commit 49730ed4751ad39a58479b57c4ad67665c9bc06e
Showing with 10 additions and 3 deletions.
  1. +7 −3 src/core/qgsproject.cpp
  2. +3 −0 tests/src/python/test_qgsproject.py
@@ -494,6 +494,13 @@ void QgsProject::clear()
mRootGroup->clear();

mLabelingEngineSettings->clear();

// unzip action use read() method to read the embedded qgs project file.
// And read() clear everything in a first step. But we don't want to reset
// the current archive while unzipping...
if ( !mUnzipping )
mArchive->clear();

emit labelingEngineSettingsChanged();

// reset some default project properties
@@ -765,9 +772,6 @@ bool QgsProject::read()
{
clearError();

if ( ! mUnzipping )
mArchive->clear();

std::unique_ptr<QDomDocument> doc( new QDomDocument( QStringLiteral( "qgis" ) ) );

if ( !mFile.open( QIODevice::ReadOnly | QIODevice::Text ) )
@@ -750,6 +750,9 @@ def test_zip_unzip(self):
self.assertTrue(layers[l0.id()].isValid(), True)
self.assertTrue(layers[l1.id()].isValid(), True)

project2.clear()
self.assertFalse(project2.unzipped())


if __name__ == '__main__':
unittest.main()

0 comments on commit 49730ed

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