Skip to content

Commit b18cbc7

Browse files
committedSep 13, 2019
Use unique_ptr for QgsVectorLayerServerProperties in QgsVectorLayer
1 parent ea0c174 commit b18cbc7

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed
 

‎src/core/qgsvectorlayer.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ QgsVectorLayer::QgsVectorLayer( const QString &vectorLayerPath,
145145
const QString &providerKey,
146146
const QgsVectorLayer::LayerOptions &options )
147147
: QgsMapLayer( QgsMapLayerType::VectorLayer, baseName, vectorLayerPath )
148+
, mServerProperties( new QgsVectorLayerServerProperties( this ) )
148149
, mAuxiliaryLayer( nullptr )
149150
, mAuxiliaryLayerKey( QString() )
150151
, mReadExtentFromXml( options.readExtentFromXml )
@@ -165,8 +166,6 @@ QgsVectorLayer::QgsVectorLayer( const QString &vectorLayerPath,
165166
mJoinBuffer->setParent( this );
166167
connect( mJoinBuffer, &QgsVectorLayerJoinBuffer::joinedFieldsChanged, this, &QgsVectorLayer::onJoinedFieldsChanged );
167168

168-
mServerProperties = new QgsVectorLayerServerProperties( this );
169-
170169
mExpressionFieldBuffer = new QgsExpressionFieldBuffer();
171170
// if we're given a provider type, try to create and bind one to this layer
172171
if ( !vectorLayerPath.isEmpty() && !mProviderKey.isEmpty() )

‎src/core/qgsvectorlayer.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte
652652
* Returns QGIS Server Properties of the vector layer
653653
* \since QGIS 3.10
654654
*/
655-
QgsVectorLayerServerProperties *serverProperties() { return mServerProperties; }
655+
QgsVectorLayerServerProperties *serverProperties() { return mServerProperties.get(); }
656656

657657
/**
658658
* Returns the number of features that are selected in this layer.
@@ -2640,7 +2640,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte
26402640
QgsVectorLayerJoinBuffer *mJoinBuffer = nullptr;
26412641

26422642
//!stores information about server properties
2643-
QgsVectorLayerServerProperties *mServerProperties = nullptr;
2643+
std::unique_ptr< QgsVectorLayerServerProperties > mServerProperties;
26442644

26452645
//! stores information about expression fields on this layer
26462646
QgsExpressionFieldBuffer *mExpressionFieldBuffer = nullptr;

0 commit comments

Comments
 (0)
Please sign in to comment.