Skip to content

Commit

Permalink
Merge pull request #38621 from qgis-bot/backport-38594-to-release-3_10
Browse files Browse the repository at this point in the history
[Backport release-3_10] Fix project never completes loading layers when a layer has a missing dependancy
  • Loading branch information
m-kuhn committed Sep 12, 2020
2 parents 962bbff + 5b55cad commit 1c72a69
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/core/qgsproject.cpp
Expand Up @@ -951,13 +951,17 @@ bool QgsProject::_getMapLayers( const QDomDocument &doc, QList<QDomNode> &broken

bool returnStatus = true;

emit layerLoaded( 0, nl.count() );

// order layers based on their dependencies
QgsLayerDefinition::DependencySorter depSorter( doc );
if ( depSorter.hasCycle() || depSorter.hasMissingDependency() )
if ( depSorter.hasCycle() )
return false;

// Missing a dependency? We still load all the layers, otherwise the project is completely broken!
if ( depSorter.hasMissingDependency() )
returnStatus = false;

emit layerLoaded( 0, nl.count() );

const QVector<QDomNode> sortedLayerNodes = depSorter.sortedLayerNodes();
const int totalLayerCount = sortedLayerNodes.count();

Expand Down

0 comments on commit 1c72a69

Please sign in to comment.