Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
MetadataUrls - use unique_ptr
  • Loading branch information
dmarteau authored and Gustry committed Sep 16, 2021
1 parent 8b6395d commit 2e9a151
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
5 changes: 2 additions & 3 deletions src/core/qgsmaplayer.cpp
Expand Up @@ -84,7 +84,7 @@ QgsMapLayer::QgsMapLayer( QgsMapLayerType type,
: mDataSource( source )
, mLayerName( lyrname )
, mLayerType( type )
, mServerProperties( new QgsMapLayerServerProperties( this ) )
, mServerProperties( std::make_unique<QgsMapLayerServerProperties>( this ) )
, mUndoStack( new QUndoStack( this ) )
, mUndoStackStyles( new QUndoStack( this ) )
, mStyleManager( new QgsMapLayerStyleManager( this ) )
Expand All @@ -101,7 +101,6 @@ QgsMapLayer::~QgsMapLayer()
delete m3DRenderer;
delete mLegend;
delete mStyleManager;
delete mServerProperties;
}

void QgsMapLayer::clone( QgsMapLayer *layer ) const
Expand Down Expand Up @@ -135,7 +134,7 @@ void QgsMapLayer::clone( QgsMapLayer *layer ) const
layer->setCustomProperties( mCustomProperties );
layer->setOpacity( mLayerOpacity );
layer->setMetadata( mMetadata );
layer->serverProperties()->clone( mServerProperties );
layer->serverProperties()->clone( mServerProperties.get() );
}

QgsMapLayerType QgsMapLayer::type() const
Expand Down
6 changes: 3 additions & 3 deletions src/core/qgsmaplayer.h
Expand Up @@ -419,13 +419,13 @@ class CORE_EXPORT QgsMapLayer : public QObject
* Returns QGIS Server Properties for the map layer
* \since QGIS 3.22
*/
QgsMapLayerServerProperties *serverProperties() { return mServerProperties; };
QgsMapLayerServerProperties *serverProperties() { return mServerProperties.get(); };

/**
* Returns QGIS Server Properties const for the map layer
* \since QGIS 3.22
*/
const QgsMapLayerServerProperties *serverProperties() const { return mServerProperties; } SIP_SKIP;
const QgsMapLayerServerProperties *serverProperties() const { return mServerProperties.get(); } SIP_SKIP;

/**
* Sets the metadata URL of the layer
Expand Down Expand Up @@ -2066,7 +2066,7 @@ class CORE_EXPORT QgsMapLayer : public QObject
/**
* Stores information about server properties
*/
QgsMapLayerServerProperties *mServerProperties = nullptr;
std::unique_ptr< QgsMapLayerServerProperties > mServerProperties;

//! Collection of undoable operations for this layer.
QUndoStack *mUndoStack = nullptr;
Expand Down

0 comments on commit 2e9a151

Please sign in to comment.