Re: [gtk-list] Re: proper way to clean up



Aaron Walker, dans le message (.gtk.general:358), a écrit :
> what would I do instead? Just have one generic widget that would be used for
> all of them?

You only need to remember the widgets you'll need to access later. So you
have to keep Entry's or CheckButton's, but the boxes used for the structure
(boxes...), or that won't be accessed (Buttons, that won't be set inactive)
can be created in a local variable and forgotten as the window is finished.

> Window *win = g_malloc(sizeof(Window *));

This one will allocate size for one pointer (4 bytes on much systems).

> Window *win = g_malloc(sizeof(Window));

This one will allocate size for one structure.

So you must use the second one, or you'll get a segfault.



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