You can also put the object into a smart pointer. I'd recommend
boost's shared_ptr.

Paul

On 6/6/07, Murray Cumming <[EMAIL PROTECTED]> wrote:
> On Wed, 2007-06-06 at 10:16 +0200, Toralf Lund wrote:
> > Just found myself in a situation where a Gtk::Dialog has to be
> >
> >    1. Allocated using "new"
> >    2. Deleted as and when the user presses a button, i.e. on "response".
> >
> > (I'm otherwise using Gtk::Dialog with local variables and the run()
> > method most of the time.)
> >
> > So, what's the best way of setting up for deletion of the object? I
> > mean, I know how it may be done, of course, but is there any kind of
> > built-in support, or any recommendations?
>
> Just delete it, like any other object.
>
> >  Seems to me that the obvious
> > solution, i.e. doing "delete this" inside a signal handler, is something
> > that one would not necessarily recommend...
>
> Yes, I would personally avoid doing "delete this", and I would avoid
> deleting things in the signal handler for the object that I'm deleting.
>
> But this is actually meant to work, so it would be a bug if it didn't.
> glib and GTK+ and libsigc++ and gtkmm has code to support it.
>
> --
> Murray Cumming
> [EMAIL PROTECTED]
> www.murrayc.com
> www.openismus.com
>
> _______________________________________________
> gtkmm-list mailing list
> [email protected]
> http://mail.gnome.org/mailman/listinfo/gtkmm-list
>
_______________________________________________
gtkmm-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtkmm-list

Reply via email to