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

Canvas_PrintLayout: 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 912b4eb0
......@@ -286,7 +286,7 @@ void Canvas_PrintLayout::setup_context_menu()
menu->append(_("_Edit"), "context.edit");
menu->append(_("_Formatting"), "context.formatting");
menu->append(_("_Delete"), "context.delete");
m_context_menu = new Gtk::Menu(menu);
m_context_menu = std::make_unique<Gtk::Menu>(menu);
m_context_menu->attach_to_widget(*this);
}
......
......@@ -151,7 +151,7 @@ private:
type_vec_margins m_vec_margin_bottoms;
//Context menu for existing items:
Gtk::Menu* m_context_menu;
std::unique_ptr<Gtk::Menu> m_context_menu;
Glib::RefPtr<Gio::SimpleActionGroup> m_context_menu_action_group;
Glib::RefPtr<Gio::SimpleAction> m_action_edit, m_action_formatting, m_action_delete;
Glib::RefPtr<CanvasLayoutItem> m_context_item; //The selected item when showing the context menu.,
......
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