Skip to content

Commit cc5d3bc

Browse files
committedOct 29, 2014
Merge pull request #1668 from m-kuhn/action-menu-crash
Alternative approach to f9fcee9
2 parents 4cf08c5 + a7f889d commit cc5d3bc

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed
 

‎src/gui/qgsattributedialog.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
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 )
3231
{
3332
QgsAttributeEditorContext context;
3433
context.setDistanceArea( myDa );
@@ -37,17 +36,22 @@ QgsAttributeDialog::QgsAttributeDialog( QgsVectorLayer* vl, QgsFeature* thepFeat
3736

3837
if ( !showDialogButtons )
3938
mAttributeForm->hideButtonBox();
39+
40+
if ( featureOwner )
41+
delete thepFeature;
4042
}
4143

4244
QgsAttributeDialog::QgsAttributeDialog( QgsVectorLayer* vl, QgsFeature* thepFeature, bool featureOwner, QWidget* parent, bool showDialogButtons, QgsAttributeEditorContext context )
4345
: QDialog( parent )
4446
, mHighlight( 0 )
45-
, mOwnedFeature( featureOwner ? thepFeature : 0 )
4647
{
4748
init( vl, thepFeature, context, parent );
4849

4950
if ( !showDialogButtons )
5051
mAttributeForm->hideButtonBox();
52+
53+
if ( featureOwner )
54+
delete thepFeature;
5155
}
5256

5357
QgsAttributeDialog::~QgsAttributeDialog()
@@ -58,9 +62,6 @@ QgsAttributeDialog::~QgsAttributeDialog()
5862
delete mHighlight;
5963
}
6064

61-
if( mOwnedFeature )
62-
delete mOwnedFeature;
63-
6465
saveGeometry();
6566
}
6667

@@ -110,7 +111,7 @@ void QgsAttributeDialog::init( QgsVectorLayer* layer, QgsFeature* feature, QgsAt
110111
connect( buttonBox, SIGNAL( accepted() ), this, SLOT( accept() ) );
111112

112113
mMenuBar = new QMenuBar( this );
113-
QgsActionMenu* menu = new QgsActionMenu( layer, feature, this );
114+
QgsActionMenu* menu = new QgsActionMenu( layer, &mAttributeForm->feature(), this );
114115
mMenuBar->addMenu( menu );
115116
layout()->setMenuBar( mMenuBar );
116117

‎src/gui/qgsattributedialog.h

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

141140
// true if this dialog is editable
142141
bool mEditable;

0 commit comments

Comments
 (0)
Please sign in to comment.