Commit b32655d1 authored by Murray Cumming's avatar Murray Cumming
Browse files

Db_AddDel: Use std::unique_ptr<> for the menu, instead of new and delete.

I am not very happy with passing the raw pointer to gtkmm's
attach_to_widget(), but that seems to be the normal use of
unique_ptr<>::operator*() and unique_ptr<>::get(),
as long as we don't expect the receiving API to take any
ownership.
parent 70172b4e
......@@ -46,7 +46,6 @@ DbAddDel::DbAddDel()
m_column_is_sorted(false),
m_column_sorted_direction(false),
m_column_sorted(0),
m_pMenuPopup(nullptr),
m_bAllowUserActions(true),
m_bPreventUserSignals(false),
m_bIgnoreTreeViewSignals(false),
......@@ -260,7 +259,7 @@ void DbAddDel::setup_menu(Gtk::Widget* /* widget */)
menu->append(_("_Layout"), "context.layout");
#endif
m_pMenuPopup = new Gtk::Menu(menu);
m_pMenuPopup = std::make_unique<Gtk::Menu>(menu);
m_pMenuPopup->attach_to_widget(*this);
if(get_allow_user_actions())
......
......@@ -402,7 +402,7 @@ protected:
private:
//TODO: Avoid repeating these in so many widgets:
Gtk::Menu* m_pMenuPopup;
std::unique_ptr<Gtk::Menu> m_pMenuPopup;
Glib::RefPtr<Gio::SimpleActionGroup> m_refActionGroup;
Glib::RefPtr<Gio::SimpleAction> m_refContextEdit, m_refContextAdd, m_refContextDelete;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment