Re: need help with passing a GSList of GtkWidget's as a gpointer



Sean Scanlon <scanlons minn teradyne com> writes:
> void function0(void)
> {
>   GtkWidget* button;
>   GSList*    button_list;

As someone else said, you need to init this to NULL

>   gint       i;
> 
>   /* create & setup window ... */
> 
>   for (i=0; i<8; i++) {   /* populate GSList */
>     button = gtk_check_button_new();
>     button_list = g_slist_append( button_list, button );
>     /* pack check button somewhere ... */
>   }
> 
>   button = gtk_button_new_with_label("Set All");
>   gtk_signal_connect( GTK_OBJECT(button), "clicked",
>                       GTK_SIGNAL_FUNC(set_all_button_clicked_cb),
>                       button_list );
>   /* pack "set all" button somewhere ... */
> 
>   g_slist_free(button_list);

But also, you can't free the list, because you are trying to use it in
the callback.

Havoc




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