Re: [gtk-list] proper way to clean up
- From: Federico Mena Quintero <federico redhat com>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] proper way to clean up
- Date: Mon, 29 Nov 1999 11:41:49 -0500
> I have a structure that contains all my widgets:
>
> typedef struct {
> GtkWidget *window;
> GtkWidget *vbox;
> GtkWidget *hbox;
> GtkWidget *label;
> GtkWidget *button;
> } Window;
Normally you don't need pointers to all of the "auxiliary" widgets
such as boxes and labels, but that's OK.
> now the callback main_destroy_cb:
>
> void main_destroy_cb(GtkWidget *widget, Window *win)
> {
> g_free(win);
> gtk_main_quit();
> }
>
> Is this the proper way to malloc and free memory on exit for the Window
> structure?
Yes.
> Also, if the Window structure is not free'd, it would end up in a memory
> leak, correct?
Yes.
Federico
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]