diff --git a/src/gui/qgsattributedialog.cpp b/src/gui/qgsattributedialog.cpp index f18acbbb303..52343bc3bc8 100644 --- a/src/gui/qgsattributedialog.cpp +++ b/src/gui/qgsattributedialog.cpp @@ -109,12 +109,16 @@ void QgsAttributeDialog::init( QgsVectorLayer* layer, QgsFeature* feature, QgsAt connect( buttonBox, SIGNAL( rejected() ), this, SLOT( reject() ) ); connect( buttonBox, SIGNAL( accepted() ), this, SLOT( accept() ) ); - mMenuBar = new QMenuBar( this ); QgsActionMenu* menu = new QgsActionMenu( layer, &mAttributeForm->feature(), this ); if ( menu->actions().size() > 0 ) { - mMenuBar->addMenu( menu ); - layout()->setMenuBar( mMenuBar ); + QMenuBar* menuBar = new QMenuBar( this ); + menuBar->addMenu( menu ); + layout()->setMenuBar( menuBar ); + } + else + { + delete menu; } restoreGeometry(); diff --git a/src/gui/qgsattributedialog.h b/src/gui/qgsattributedialog.h index 4faa5fdd471..c570d5428af 100644 --- a/src/gui/qgsattributedialog.h +++ b/src/gui/qgsattributedialog.h @@ -135,7 +135,6 @@ class GUI_EXPORT QgsAttributeDialog : public QDialog bool mShowDialogButtons; QString mReturnvarname; QgsAttributeForm* mAttributeForm; - QMenuBar* mMenuBar; QgsFeature *mOwnedFeature; // true if this dialog is editable