Skip to content

Commit

Permalink
attribute dialog: really keep cloned feature until destruction (featu…
Browse files Browse the repository at this point in the history
…re action

also need it and crash otherwise)

This reverts revert commit f618cae.
  • Loading branch information
jef-n committed Oct 30, 2014
1 parent a0b5241 commit 23f39a2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/gui/qgsattributedialog.cpp
Expand Up @@ -28,6 +28,7 @@
QgsAttributeDialog::QgsAttributeDialog( QgsVectorLayer* vl, QgsFeature* thepFeature, bool featureOwner, QgsDistanceArea myDa, QWidget* parent, bool showDialogButtons )
: QDialog( parent )
, mHighlight( 0 )
, mOwnedFeature( featureOwner ? thepFeature : 0 )
{
QgsAttributeEditorContext context;
context.setDistanceArea( myDa );
Expand All @@ -36,22 +37,17 @@ QgsAttributeDialog::QgsAttributeDialog( QgsVectorLayer* vl, QgsFeature* thepFeat

if ( !showDialogButtons )
mAttributeForm->hideButtonBox();

if ( featureOwner )
delete thepFeature;
}

QgsAttributeDialog::QgsAttributeDialog( QgsVectorLayer* vl, QgsFeature* thepFeature, bool featureOwner, QWidget* parent, bool showDialogButtons, QgsAttributeEditorContext context )
: QDialog( parent )
, mHighlight( 0 )
, mOwnedFeature( featureOwner ? thepFeature : 0 )
{
init( vl, thepFeature, context, parent );

if ( !showDialogButtons )
mAttributeForm->hideButtonBox();

if ( featureOwner )
delete thepFeature;
}

QgsAttributeDialog::~QgsAttributeDialog()
Expand All @@ -62,6 +58,9 @@ QgsAttributeDialog::~QgsAttributeDialog()
delete mHighlight;
}

if( mOwnedFeature )
delete mOwnedFeature;

saveGeometry();
}

Expand Down
1 change: 1 addition & 0 deletions src/gui/qgsattributedialog.h
Expand Up @@ -136,6 +136,7 @@ class GUI_EXPORT QgsAttributeDialog : public QDialog
QString mReturnvarname;
QgsAttributeForm* mAttributeForm;
QMenuBar* mMenuBar;
QgsFeature *mOwnedFeature;

// true if this dialog is editable
bool mEditable;
Expand Down

0 comments on commit 23f39a2

Please sign in to comment.