Archive has to be cleared when clear() is called

This commit is contained in:
Blottiere Paul 2017-07-11 14:51:29 +01:00
parent 92bad9254e
commit 49730ed475
2 changed files with 10 additions and 3 deletions

View File

@ -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 ) )

View File

@ -750,6 +750,9 @@ class TestQgsProject(unittest.TestCase):
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()