Re: g_list problem



On Mon, 4 Jan 1999 14:04:39 +0100, Rodrigo Moya
<Moya_Rodrigo/madrid_tecnologia@sinvest.es> wrote:

>I have a piece of code which looks like this:
>
>    GList *children = g_list_alloc();

This should be
	GList *children = NULL;

g_list_alloc() returns a new list element (uninitialized), so the end result
is that you have an extra node with garbage information in it.

>    GtkWidget *w = gtk_entry_new();
>    gtk_widget_set_name(w, name);
>    children = g_list_append(children, (gpointer) w);
>    .... // and so on with some other entry widgets using always the 'w'
>variable to create and add the children

-- Elliot
"In film you will find four basic story lines. Man versus man, man
 versus nature, nature versus nature, and dog versus vampire."
    - Steven Spielberg



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