Skip to content
Permalink
Browse files

Fix layer dependencies double load of layers

Fixes #34226
  • Loading branch information
elpaso committed Feb 3, 2020
1 parent dd19eb8 commit e5edf52e0ce81baa797227b9efa73645e14c06b9
Showing with 14 additions and 7 deletions.
  1. +12 −5 src/app/qgisapp.cpp
  2. +2 −2 src/core/qgsvectorlayer.cpp
@@ -2044,12 +2044,19 @@ const QList<QgsVectorLayerRef> QgisApp::findBrokenLayerDependencies( QgsVectorLa
const QList<QgsVectorLayerRef> constDependencies { fieldFormatter->layerDependencies( setup.config() ) };
for ( const QgsVectorLayerRef &dependency : constDependencies )
{
const QgsVectorLayer *depVl { QgsVectorLayerRef( dependency ).resolveWeakly(
QgsProject::instance(),
QgsVectorLayerRef::MatchType::Name ) };
if ( ! depVl || ! depVl->isValid() )
// I guess we need and isNull()/isValid() method for the ref
if ( dependency.layer ||
! dependency.name.isEmpty() ||
! dependency.source.isEmpty() ||
! dependency.layerId.isEmpty() )
{
brokenDependencies.append( dependency );
const QgsVectorLayer *depVl { QgsVectorLayerRef( dependency ).resolveWeakly(
QgsProject::instance(),
QgsVectorLayerRef::MatchType::Name ) };
if ( ! depVl || ! depVl->isValid() )
{
brokenDependencies.append( dependency );
}
}
}
}
@@ -2059,7 +2059,7 @@ bool QgsVectorLayer::readSymbology( const QDomNode &layerNode, QString &errorMes
const QDomNodeList fieldPairNodes { relationElement.elementsByTagName( QStringLiteral( "fieldPair" ) ) };
for ( int j = 0; j < fieldPairNodes.length(); ++j )
{
const QDomElement fieldPairElement = fieldPairNodes.at( i ).toElement();
const QDomElement fieldPairElement = fieldPairNodes.at( j ).toElement();
fieldPairs.push_back( { fieldPairElement.attribute( QStringLiteral( "referencing" ) ),
fieldPairElement.attribute( QStringLiteral( "referenced" ) ) } );
}
@@ -2093,7 +2093,7 @@ bool QgsVectorLayer::readSymbology( const QDomNode &layerNode, QString &errorMes
const QDomNodeList fieldPairNodes { relationElement.elementsByTagName( QStringLiteral( "fieldPair" ) ) };
for ( int j = 0; j < fieldPairNodes.length(); ++j )
{
const QDomElement fieldPairElement = fieldPairNodes.at( i ).toElement();
const QDomElement fieldPairElement = fieldPairNodes.at( j ).toElement();
fieldPairs.push_back( { fieldPairElement.attribute( QStringLiteral( "referencing" ) ),
fieldPairElement.attribute( QStringLiteral( "referenced" ) ) } );
}

0 comments on commit e5edf52

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