BUG in gtk_list_store_set



Hi all !

I have a problem running my application, i get a segmentation fault with
a gtk_list_store_set

my app uses a GtkTreeView with a GtkListStore, and, it crashes when i
read the data from a simple struct ( this for my example ).

i used gdb, but i don't find the error in my code, but, i know where is
this error. 

here is the function's code of create_model :
static GtkTreeModel *create_model (void)
{
        gint i = 0;
        GtkListStore *store;
        GtkTreeIter iter;
        store = gtk_list_store_new (
                NUM_COLUMNS, 
                G_TYPE_STRING, 
                G_TYPE_STRING);
        for (i = 0; i < G_N_ELEMENTS (data); i++) {
                gtk_list_store_append (store, &iter);
                gtk_list_store_set( 
                        store, 
                        &iter, 
                        CONTACT_COLUMN_FIRSTNAME, 
                        data[i].firstname, 
                        CONTACT_COLUMN_LASTNAME, 
                        data[i].lastname, 
                        -1);
                }
        return GTK_TREE_MODEL (store);
}

and here is the contains of my struct
typedef struct 
{
        gchar *firstname;
        gchar *lastname;
        gchar *street;
        gint number;
        gchar *location;
        gint zipcode;
        
        gchar *phone_gsm;
        gchar *phone_fix;
        gchar *email;
        gpointer photo;
} Contact;

enum
{
        CONTACT_COLUMN_FIRSTNAME, 
        CONTACT_COLUMN_LASTNAME,
        CONTACT_COLUMN_STREET,
        CONTACT_COLUMN_NUMBER,
        CONTACT_COLUMN_LOCATION,
        CONTACT_COLUMN_ZIPCODE,
        CONTACT_COLUMN_PHONE_GSM,
        CONTACT_COLUMN_PHONE_FIX,
        CONTACT_COLUMN_EMAIL,
        NUM_COLUMNS
};

static Contact data[] = {
{       "Stephane", "Wirtel",   "Rue XXX", 53, "charleroi", 9999,
"0474/xx.yy.zz.vv", "071/xx.yy.zz",
"stephane wirtel belgacom net", NULL    }
};

sorry, but i did not find the reason of this "Segmentation Fault", if
anyone wants my code, it's available on
http://www.linux-mons.be/download/gContacts.tar.bz2

Thanks

----------------




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