Re: Deleting pointers used by Libglademm

Am Sonntag, den 28.01.2007, 16:16 -0200 schrieb Arthur Maciel:
> Hi.
> When I use libglademm get_widget() function to give the widget address
> to a pointer, do I have to run delete on the pointer to clean memory?

Only for widgets that are not the child of some container widget.
Unless you're doing something special, this means you only have to
delete toplevel windows.  And you can use std::auto_ptr<> for that.

class Foo
  std::auto_ptr<Gtk::Window> window_;
  void load_xml();

void Foo::load_xml()
  using Gnome::Glade::Xml;

  const Glib::RefPtr<Xml> xml = Xml::create(glade_mainwindow_filename);

  Gtk::Window* mainwindow = 0;
  window_.reset(xml->get_widget("mainwindow", mainwindow));



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