Re: preferred way to destroy a window
- From: Murray Cumming <murrayc murrayc com>
- To: Paul Pogonyshev <pogonyshev gmx net>
- Cc: gtkmm-list gnome org
- Subject: Re: preferred way to destroy a window
- Date: Thu, 03 Aug 2006 21:30:56 +0200
On Thu, 2006-08-03 at 22:01 +0300, Paul Pogonyshev wrote:
> Maybe it is a stupid question, but I was unable to find the answer.
> What is the preferred way to destroy a window in Gtkmm?
delete, as for other C++ objects.
Gtk::Window* window = new Gtk::Window();
If what you actually want to do is hide the window then just call hide:
> In pure C
> I'd call gtk_widget_destroy(), but what do I do in C++? (Calling
> `delete this' leads to a segmenation fault, but maybe it's my error,
> not sure...)
"delete this" should also work, as for other C++ objects, though many
people prefer to avoid it, because you need to be very careful that the
window is not being used elsewhere.
Also, "delete this" would obviously cause a segfault if the window was
not allocated with new - for instance if the instance was a member
variable of another class, as in many of the gtkmm examples.
If this doesn't explain things, try posting a small example of what you
murrayc murrayc com
] [Thread Prev