[pygtk] Problem pygtk and treeview and TreeStore

Mike Bernson mike at mlb.org
Sat Apr 17 09:44:21 WST 2010


I have created a Treeview with a TreeStore in it.

The TreeStore has sort_function set each column and
default sort.

When the sort_function is called I get called with a invalid iter.

I check the iter uising follow code:
        if not treemodel.iter_is_valid(iter1) or not treemodel.iter_is_valid(iter2):
             raise RuntimeError('one of iter to compare is not valid')


I set a break point at the raise to make sure that the iter is bad.

If I run comment out the check and run the program it segfaults. I
try running the program under gdb here is stack_trace for when it
dies:
gtk_tree_store_compare_func (a=0x8000000003f87ff0, b=0x3f88000,
     user_data=0x30ccec0)
     at /build/buildd/gtk+2.0-2.18.3/gtk/gtktreestore.c:2766
2766	/build/buildd/gtk+2.0-2.18.3/gtk/gtktreestore.c: No such file or directory.
	in /build/buildd/gtk+2.0-2.18.3/gtk/gtktreestore.c
(gdb) print a
$1 = (gconstpointer) 0x8000000003f87ff0
(gdb) print b
$2 = (gconstpointer) 0x3f88000


Looking at the source code a and b are the two iter being pass sort_function.

b looks like a good address a look like a bad address.

Here is C code:
   node_a = ((SortTuple *) a)->node;
   node_b = ((SortTuple *) b)->node;

Look for some help as to how find problem ?



More information about the pygtk mailing list