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

AddDel: Use std::unique_ptr<> instead of naked new.

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 d5b76d65
......@@ -75,7 +75,6 @@ AddDelColumnInfo& AddDelColumnInfo::operator=(const AddDelColumnInfo& src)
AddDel::AddDel()
: Gtk::Box(Gtk::ORIENTATION_VERTICAL),
m_col_key(0),
m_pMenuPopup(nullptr),
m_auto_add(true),
m_allow_add(true),
m_allow_delete(true)
......@@ -87,7 +86,6 @@ AddDel::AddDel()
AddDel::AddDel(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& /* builder */)
: Gtk::Box(cobject),
m_col_key(0),
m_pMenuPopup(nullptr),
m_auto_add(true),
m_allow_add(true),
m_allow_delete(true)
......@@ -241,7 +239,7 @@ void AddDel::setup_menu(Gtk::Widget* /* widget */)
menu->append(_("_Edit"), "context.edit");
menu->append(_("_Delete"), "context.delete");
m_pMenuPopup = new Gtk::Menu(menu);
m_pMenuPopup = std::make_unique<Gtk::Menu>(menu);
m_pMenuPopup->attach_to_widget(*this);
}
......
......@@ -304,7 +304,7 @@ private:
type_vec_strings m_vecColumnIDs; //We give each ViewColumn a special ID, so we know where they are after a reorder.
Glib::ustring m_strTextActiveCell; //value before the change
Gtk::Menu* m_pMenuPopup;
std::unique_ptr<Gtk::Menu> m_pMenuPopup;
Glib::RefPtr<Gio::SimpleActionGroup> m_refActionGroup;
Glib::RefPtr<Gio::SimpleAction> m_refContextEdit, 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