Help: gtk_list_store_set causing memory fault !




I have gtk-2.0.6 on my laptop (linux) and gtk-2.6.0 on a HPUX 11.11 system. There is some code that works on the laptop but not on the HP box. I have pared the code down to the following which causes a memory fault:

-----------------------
#include <gtk/gtk.h>

enum { COLUMN_ONE, COLUMN_TWO, N_COLUMNS };

int main( int argc, char *argv[] )

{ GtkListStore *list_store;
 GtkTreeIter iter;

 gtk_init (&argc, &argv);

 list_store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING );

 gtk_list_store_append (list_store, &iter);

gtk_list_store_set (list_store, &iter, COLUMN_ONE, "one", COLUMN_TWO, "two", -1);


 gtk_main ();

 return(0);
}
-----------------

Interestingly if I use:

 gtk_list_store_set (list_store, &iter, "one", COLUMN_TWO, "two", -1);

I get:
* Gtk-WARNING **: gtkliststore.c:820: Invalid column number 11268 added to iter (remember to end your list of columns with a -1)
and NO memory fault.

and:
 gtk_list_store_set (list_store, &iter, 0 , "one", -1);
- causes a memory fault,

and
  char str[]="string";
 gtk_list_store_set(list_store, &iter, 0, *str, 1, *str, -1);
- also causes a memory fault.

Can someone PLEASE tell me what I am doing wrong.

Thanks.





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