problem with GList



Hello

I'm trying to write a little diary pragram with gtk but now
i have a problem. I get a segfault but i don't know why.
Unfortunately this is my first gtk application, therefore i
don't really know what im doing..
Perhaps you can help me and tell me what's wrong.

thank you verry much

Yves 



typedef struct {
        char *date_time_string;
        char *topic;
        char *text;
        int i;
        time_t time_t;
} DIARY_TABLE_LINE;


GList *diary_data = NULL;

void 
add_diary_entry (time_t time, char *topic, char *text)
{
        DIARY_TABLE_LINE *diary_entry, *d;
        GList *li = NULL;
        
        diary_entry = g_malloc (sizeof (DIARY_TABLE_LINE));
        
        diary_entry->date_time_string = time_t_to_string (time);
        diary_entry->topic = g_strdup (topic);
        diary_entry->text = g_strdup (text);
/*      diary_entry->time_t = time_t;   */
        
        g_list_append (diary_data, diary_entry);        
        rows++;

/* segfault roughly ishere */
        li = g_list_first (diary_data);
        d = (DIARY_TABLE_LINE *) li->data;
        printf("%s\n", (char *) d->date_time_string);
}







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