On Sun, 2005-12-18 at 12:21 +0100, Marco wrote: > On Sun, 18 Dec 2005 03:43:17 -0600, Paul Davis > <[EMAIL PROTECTED]> wrote: > > > Murray Cumming wrote: > > > >> On Fri, 2005-12-16 at 22:38 +0100, Marco wrote: > >> > >>> http://www.gtkmm.org/docs/glibmm-2.4/docs/reference/html/classGlib_1_1RefPtr.html > >>> http://www.gtkmm.org/docs/gtkmm-2.4/docs/tutorial/html/ch18s02.html > >>> > >> > >> RefPtr is not meant to be a general-purpose smartpointer. I don't > >> recommend using it with Widgets. > >> > >> > > Unless I've completely misunderstood the entire memory managemeny scheme > > used by Gtk, once you call Gtk::manage(), you release all control of > > memory management to the library. In other words, explicitly calling a > > widget's destructor ( or implicitly via smart pointer reference counting > > ) would be 'bad'. I say 'bad' cause I'm not really sure what you'd run > > into.
Deleting a managed _widget_ is normally OK. The container can detect that and just remove the widget. > I imagine you'd start getting things like memory corruption > > errors or those fun messages about freeing the same memory segment > > multiple times. Anyway, thats just how I had understood things. > > > > Paul > > manage() makes the container responsible for deleting the widget so it > would not be usefull in a case where you temporarily want to remove the > widget from its container. Not necessarily. When you remove a managed widget then you are responsible again. When you add it to a container again, then the container is responsible. > That is a case where you have to delete manually or use a smartpointer. > > -- > Marco > _______________________________________________ > gtkmm-list mailing list > [email protected] > http://mail.gnome.org/mailman/listinfo/gtkmm-list -- Murray Cumming [EMAIL PROTECTED] www.murrayc.com www.openismus.com _______________________________________________ gtkmm-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/gtkmm-list
