Skip to content

Commit 23f39a2

Browse files
committedOct 30, 2014
attribute dialog: really keep cloned feature until destruction (feature action
also need it and crash otherwise) This reverts revert commit f618cae.
1 parent a0b5241 commit 23f39a2

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed
 

‎src/gui/qgsattributedialog.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
QgsAttributeDialog::QgsAttributeDialog( QgsVectorLayer* vl, QgsFeature* thepFeature, bool featureOwner, QgsDistanceArea myDa, QWidget* parent, bool showDialogButtons )
2929
: QDialog( parent )
3030
, mHighlight( 0 )
31+
, mOwnedFeature( featureOwner ? thepFeature : 0 )
3132
{
3233
QgsAttributeEditorContext context;
3334
context.setDistanceArea( myDa );
@@ -36,22 +37,17 @@ QgsAttributeDialog::QgsAttributeDialog( QgsVectorLayer* vl, QgsFeature* thepFeat
3637

3738
if ( !showDialogButtons )
3839
mAttributeForm->hideButtonBox();
39-
40-
if ( featureOwner )
41-
delete thepFeature;
4240
}
4341

4442
QgsAttributeDialog::QgsAttributeDialog( QgsVectorLayer* vl, QgsFeature* thepFeature, bool featureOwner, QWidget* parent, bool showDialogButtons, QgsAttributeEditorContext context )
4543
: QDialog( parent )
4644
, mHighlight( 0 )
45+
, mOwnedFeature( featureOwner ? thepFeature : 0 )
4746
{
4847
init( vl, thepFeature, context, parent );
4948

5049
if ( !showDialogButtons )
5150
mAttributeForm->hideButtonBox();
52-
53-
if ( featureOwner )
54-
delete thepFeature;
5551
}
5652

5753
QgsAttributeDialog::~QgsAttributeDialog()
@@ -62,6 +58,9 @@ QgsAttributeDialog::~QgsAttributeDialog()
6258
delete mHighlight;
6359
}
6460

61+
if( mOwnedFeature )
62+
delete mOwnedFeature;
63+
6564
saveGeometry();
6665
}
6766

‎src/gui/qgsattributedialog.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ class GUI_EXPORT QgsAttributeDialog : public QDialog
136136
QString mReturnvarname;
137137
QgsAttributeForm* mAttributeForm;
138138
QMenuBar* mMenuBar;
139+
QgsFeature *mOwnedFeature;
139140

140141
// true if this dialog is editable
141142
bool mEditable;

0 commit comments

Comments
 (0)
Please sign in to comment.