Re: [gtk-list] Best Way to Destroy a Widget




On Wed, 24 Nov 1999, Jason McAfee wrote:
> If I want to destroy a widget in my program, what would be the most
> efficient way of doing so?  Please note that I do not wish to exit my

Well, efficiency is not a concern here (unless you mean programmer
efficiency ;-)

> program but only the current widget that is being displayed.  Right now
> I am using gtk_widget_destroy(widget) which is called by a delete_event
> signal.  You can close the widget only twice, but the third time you
> close it I get a segmentation fault.  I also want to make sure that all

Call gtk_widget_destroy() but be aware that by default a delete_event
already results in a gtk_widget_destroy() so if you do it manually it will
happen twice; two destroys leads to memory corruption and possibly a
segfault eventually.

You might read what my book has to say about this,
developer.gnome.org/doc/GGAD, chapter 3 on GTK and the GtkObject chapter
will both help.

Havoc




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