Skip to content

Commit

Permalink
Fix memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Nov 20, 2017
1 parent 4e16665 commit 89f6ca9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
6 changes: 5 additions & 1 deletion python/gui/symbology/qgsrulebasedrendererwidget.sip
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ Tree model for the rules:
#include "qgsrulebasedrendererwidget.h"
%End
public:
QgsRuleBasedRendererModel( QgsRuleBasedRenderer *r );

QgsRuleBasedRendererModel( QgsRuleBasedRenderer *renderer, QObject *parent );
%Docstring
Constructor for QgsRuleBasedRendererModel, for the specified ``renderer``.
%End

virtual Qt::ItemFlags flags( const QModelIndex &index ) const;
virtual QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const;
Expand Down
7 changes: 4 additions & 3 deletions src/gui/symbology/qgsrulebasedrendererwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ QgsRuleBasedRendererWidget::QgsRuleBasedRendererWidget( QgsVectorLayer *layer, Q
setupUi( this );
this->layout()->setContentsMargins( 0, 0, 0, 0 );

mModel = new QgsRuleBasedRendererModel( mRenderer );
mModel = new QgsRuleBasedRendererModel( mRenderer, viewRules );
#ifdef ENABLE_MODELTEST
new ModelTest( mModel, this ); // for model validity checking
#endif
Expand Down Expand Up @@ -799,8 +799,9 @@ void QgsRendererRulePropsWidget::setDockMode( bool dockMode )

/////

QgsRuleBasedRendererModel::QgsRuleBasedRendererModel( QgsRuleBasedRenderer *r )
: mR( r )
QgsRuleBasedRendererModel::QgsRuleBasedRendererModel( QgsRuleBasedRenderer *renderer, QObject *parent )
: QAbstractItemModel( parent )
, mR( renderer )
{
}

Expand Down
6 changes: 5 additions & 1 deletion src/gui/symbology/qgsrulebasedrendererwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ class GUI_EXPORT QgsRuleBasedRendererModel : public QAbstractItemModel
Q_OBJECT

public:
QgsRuleBasedRendererModel( QgsRuleBasedRenderer *r );

/**
* Constructor for QgsRuleBasedRendererModel, for the specified \a renderer.
*/
QgsRuleBasedRendererModel( QgsRuleBasedRenderer *renderer, QObject *parent );

virtual Qt::ItemFlags flags( const QModelIndex &index ) const override;
virtual QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const override;
Expand Down

0 comments on commit 89f6ca9

Please sign in to comment.