Skip to content

Commit

Permalink
RAII
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Mar 9, 2019
1 parent 785dd7f commit e41766e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
11 changes: 1 addition & 10 deletions src/core/qgsvectorlayerlabelprovider.cpp
Expand Up @@ -47,13 +47,7 @@ QgsVectorLayerLabelProvider::QgsVectorLayerLabelProvider( QgsVectorLayer *layer,

if ( withFeatureLoop )
{
mSource = new QgsVectorLayerFeatureSource( layer );
mOwnsSource = true;
}
else
{
mSource = nullptr;
mOwnsSource = false;
mSource = qgis::make_unique<QgsVectorLayerFeatureSource>( layer );
}

init();
Expand Down Expand Up @@ -94,9 +88,6 @@ void QgsVectorLayerLabelProvider::init()
QgsVectorLayerLabelProvider::~QgsVectorLayerLabelProvider()
{
qDeleteAll( mLabels );

if ( mOwnsSource )
delete mSource;
}


Expand Down
4 changes: 1 addition & 3 deletions src/core/qgsvectorlayerlabelprovider.h
Expand Up @@ -108,9 +108,7 @@ class CORE_EXPORT QgsVectorLayerLabelProvider : public QgsAbstractLabelProvider
//! Layer's CRS
QgsCoordinateReferenceSystem mCrs;
//! Layer's feature source
QgsAbstractFeatureSource *mSource = nullptr;
//! Whether layer's feature source is owned
bool mOwnsSource;
std::unique_ptr<QgsAbstractFeatureSource> mSource;

//! List of generated
QList<QgsLabelFeature *> mLabels;
Expand Down

0 comments on commit e41766e

Please sign in to comment.