Skip to content

Commit

Permalink
Archive has to be cleared when clear() is called
Browse files Browse the repository at this point in the history
  • Loading branch information
pblottiere committed Jul 31, 2017
1 parent 92bad92 commit 49730ed
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/core/qgsproject.cpp
Expand Up @@ -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
Expand Down Expand Up @@ -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 ) )
Expand Down
3 changes: 3 additions & 0 deletions tests/src/python/test_qgsproject.py
Expand Up @@ -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.