Stamp doesn't match in iterator in sort method of a tree model



Hello,

I have a problem with a custom sort method in a tree model. The bigger
problem is that I don't know how it could be reproduced with a simple
example. I didn't manage to isolate it. Actually the tree model contains
data from some files. And it seems to fail only for some data set.

Then I know it won't be easy for you to think about some solutions. But I
will try to give enough information so it could ring a bell to someone...

Sometimes, in my sort method, I get an assertion telling me the stamp
found in the iterator doesn't match the one in the model.

Gtk-CRITICAL **: gtk_tree_model_filter_get_value: assertion
`GTK_TREE_MODEL_FILTER (model)->priv->stamp == iter->stamp' failed at
GCItemsLists.pm line 1553.


The model and the iterator I use both come from the input parameters of my
sort method. I also noticed that the problems always occurs with the
second iterator my method get (but this could be pure coincidence).

What is a little special in my application (even if I don't think it's
really specific), is that there are 3 models stacked. The real one, one to
filter and one to sort.

I add below the parts of the code that could be involved in this problem.
So it's not complete and could reference some variables elsewhere. The
error is raised by the last line of code, when trying to get value for
$iter2.

I hope someone could give me some clues about what happens here because I
have no more ideas. I tried to use one of the other models to get the
value from the iterator, but all of them generates the same error. So it
looks like this iterator is not attached to any model.

Thanks in advance for any help.

Cheers,

Tian.



# @columnsType filled here

$self->{model} = new Gtk2::TreeStore(@columnsType);
$self->{filter} = new Gtk2::TreeModelFilter($self->{model});
$self->{filter}->set_visible_column($self->{visibleCol});

{
    package GCTreeModelSort;
    use Glib::Object::Subclass
        Gtk2::TreeModelSort::,
        interfaces => [ 'Gtk2::TreeDragDest' ],
        ;

    sub new
    {
        my ($proto, $childModel) = @_;
        my $class = ref($proto) || $proto;
        return Glib::Object::new ($class, model => $childModel);
    }
}

$self->{sorter} = new GCTreeModelSort($self->{filter});

$self->{sorter}->set_sort_func(0,
                               \&sortFunc,
                               $sortCol);

sub sortFunc
{
    my ($childModel, $iter1, $iter2, $sortCol) = @_;
    my $idx1 = $childModel->get_value($iter1, $sortCol);
    my $idx2 = $childModel->get_value($iter2, $sortCol);
}




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