Skip to content

Commit

Permalink
Fix memory leak and pass ownership of py editor widgets to C++
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Aug 3, 2014
1 parent 44bed00 commit f63a01c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions python/gui/editorwidgets/core/qgseditorwidgetfactory.sip
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class QgsEditorWidgetFactory
*
* @return A new widget wrapper
*/
virtual QgsEditorWidgetWrapper* create( QgsVectorLayer* vl, int fieldIdx, QWidget* editor, QWidget* parent ) const = 0;
virtual QgsEditorWidgetWrapper* create( QgsVectorLayer* vl, int fieldIdx, QWidget* editor, QWidget* parent ) const = 0 /Factory/;

/**
* Return The human readable identifier name of this widget type
Expand All @@ -63,7 +63,7 @@ class QgsEditorWidgetFactory
*
* @return A configuration widget
*/
virtual QgsEditorConfigWidget* configWidget( QgsVectorLayer* vl, int fieldIdx, QWidget* parent ) const = 0;
virtual QgsEditorConfigWidget* configWidget( QgsVectorLayer* vl, int fieldIdx, QWidget* parent ) const = 0 /Factory/;

/**
* Read the config from an XML file and map it to a proper {@link QgsEditorWidgetConfig}.
Expand Down
2 changes: 1 addition & 1 deletion python/gui/editorwidgets/core/qgseditorwidgetwrapper.sip
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class QgsEditorWidgetWrapper : QObject
static QgsEditorWidgetWrapper* fromWidget( QWidget* widget );

protected:
virtual QWidget* createWidget( QWidget* parent ) = 0 /Factory/;
virtual QWidget* createWidget( QWidget* parent ) = 0;

virtual void initWidget( QWidget* editor );

Expand Down
2 changes: 2 additions & 0 deletions src/app/qgsattributetypedialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ QgsAttributeTypeDialog::~QgsAttributeTypeDialog()
{
QSettings settings;
settings.setValue( "/Windows/QgsAttributeTypeDialog/geometry", saveGeometry() );

qDeleteAll( mEditorConfigWidgets.values() );
}

const QString QgsAttributeTypeDialog::editorWidgetV2Type()
Expand Down

0 comments on commit f63a01c

Please sign in to comment.