Skip to content

Commit

Permalink
[Bugfix] QgsVectorLayer: FlagForceReadOnly not used in readXml
Browse files Browse the repository at this point in the history
The flag `FlagForceReadOnly` was not checked before the dataprovider was created in the `QgsVectorLayer::readXml` method.

Funded by Ifremer https://wwz.ifremer.fr/
  • Loading branch information
rldhont authored and nyalldawson committed Feb 6, 2023
1 parent c9e83de commit d20e66d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/core/vector/qgsvectorlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1767,6 +1767,11 @@ bool QgsVectorLayer::readXml( const QDomNode &layer_node, QgsReadWriteContext &c
{
flags |= QgsDataProvider::FlagTrustDataSource;
}
if ( mReadFlags & QgsMapLayer::FlagForceReadOnly )
{
flags |= QgsDataProvider::ForceReadOnly;
mDataSourceReadOnly = true;
}
if ( ( mReadFlags & QgsMapLayer::FlagDontResolveLayers ) || !setDataProvider( mProviderKey, options, flags ) )
{
if ( !( mReadFlags & QgsMapLayer::FlagDontResolveLayers ) )
Expand All @@ -1778,11 +1783,6 @@ bool QgsVectorLayer::readXml( const QDomNode &layer_node, QgsReadWriteContext &c
if ( elem.hasAttribute( QStringLiteral( "wkbType" ) ) )
mWkbType = qgsEnumKeyToValue( elem.attribute( QStringLiteral( "wkbType" ) ), mWkbType );
}
if ( mReadFlags & QgsMapLayer::FlagForceReadOnly )
{
flags |= QgsDataProvider::ForceReadOnly;
mDataSourceReadOnly = true;
}

QDomElement pkeyElem = pkeyNode.toElement();
if ( !pkeyElem.isNull() )
Expand Down

0 comments on commit d20e66d

Please sign in to comment.