Re: MenuItem created by Action, manual deletion needed?



On Sat, 2007-12-22 at 14:12 +0100, fidel wrote:
> I am very new to gtkmm and have some issues with memory management. I
> ask myself, whether a call of an actions method create_menu_item()
> allocates memory for the returned menu_item which I would need to free
> again, or if this item gets destroyed with the according reference to
> the action.
> For example:
> 
> Glib::RefPtr<Gtk::Action> ref_action_info =
> Gtk::Action::create("InfoAction", Gtk::Stock::INFO);
> 
> Gtk::MenuItem* m_item_info = ref_action_info->create_menu_item();

These are managed by their container, so you don't need to delete them.
We should make that clearer in the reference documentation.

> Do I need to delete m_item_info by myself or does this item get
> destroyed as soon as the reference pointer gets destroyed?
> 
> I really appreciate any hints!
> Thanks a lot!

-- 
murrayc murrayc com
www.murrayc.com
www.openismus.com



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]