Skip to content
Permalink
Browse files
Fix memory leak in labeling dock
  • Loading branch information
nyalldawson committed May 2, 2016
1 parent 12f923f commit 17a9534
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
@@ -45,13 +45,13 @@ QgsLabelingWidget::QgsLabelingWidget( QgsVectorLayer* layer, QgsMapCanvas* canva

void QgsLabelingWidget::resetSettings()
{
if ( mOldSettings )
if ( mOldSettings.data() )
{
mLayer->setLabeling( mOldSettings );
if ( mOldSettings->type() == "simple" )
{
mOldPalSettings.writeToLayer( mLayer );
}
mLayer->setLabeling( mOldSettings.take() );
}
setLayer( mLayer );
}
@@ -75,11 +75,11 @@ void QgsLabelingWidget::setLayer( QgsMapLayer* mapLayer )
{
QDomDocument doc;
QDomElement oldSettings = mLayer->labeling()->save( doc );
mOldSettings = QgsAbstractVectorLayerLabeling::create( oldSettings );
mOldSettings.reset( QgsAbstractVectorLayerLabeling::create( oldSettings ) );
mOldPalSettings.readFromLayer( mLayer );
}
else
mOldSettings = nullptr;
mOldSettings.reset();

adaptToLayer();
}
@@ -5,11 +5,11 @@

#include <ui_qgslabelingwidget.h>
#include <qgspallabeling.h>
#include "qgsvectorlayerlabeling.h"

class QgsLabelingGui;
class QgsMapCanvas;
class QgsRuleBasedLabelingWidget;
class QgsAbstractVectorLayerLabeling;
class QgsVectorLayer;
class QgsMapLayer;

@@ -51,7 +51,7 @@ class QgsLabelingWidget : public QWidget, private Ui::QgsLabelingWidget

QWidget* mWidget;
QgsLabelingGui* mLabelGui;
QgsAbstractVectorLayerLabeling* mOldSettings;
QScopedPointer< QgsAbstractVectorLayerLabeling > mOldSettings;
QgsPalLayerSettings mOldPalSettings;
};

0 comments on commit 17a9534

Please sign in to comment.