[REGRESSION] children_iter does not return any valid iterator

unlike gtk2-perl inline tree, i failled to get a valid iter from

in rpmdrake and drakfloppy, we fill the tree on demand since we do not
want to load 6000 packages in rpmdrake on startup or 1300 modules in
drakfloppy on startup due to slow down.
so we ended in adding a dummy empty line in the trees when we know
they were stuff to display if one expand the corresponding tree
we then remove that empty line on expanding, then filling the branch
with leafs corresponding to packages (rpmdrake) or modules
(drakfloppy) to list.

but now, when i try to get the dummy child with ->children_iter, i
only got the following errors:
(drakfloppy:11242): Gtk-CRITICAL **: file ../../gtk/gtktreestore.c: line 1071 (gtk_tree_store_remove): 
assertion `VALID_ITER (iter, tree_store)' failed

if i replace
    $tree_model->remove($child) if $tree_model->iter_is_valid($child)
                                   && $tree_model->get($child, 0) eq '';

i get rid of the gtk+ error ... but dummy lines got displayed :-(

code involved in drakfloppy[0] is (hacked[1] in order to run with

# Callback for expanding a tree - find subdirectories, files and add them to tree
sub expand_tree {
    my ($tree, $parent_iter, $path) = @_;
    return if !$tree || !$parent_iter;
    my $dir   = $tree_model->get($parent_iter, 1);

    #- if we're hinted to be expandable
    if ($tree_model->get($parent_iter, 2)) {
        #- hackish: if first child has '' as name, then we need to expand on the fly
        if ($tree_model->iter_has_child($parent_iter)) {
            my $child = $tree_model->iter_children($parent_iter);
            # BUG: ->iter_children return invalid iterators !!! thus the dummy empty line
            $tree_model->remove($child) if $tree_model->iter_is_valid($child) && $tree_model->get($child, 0) 
eq '';
        # do not refill the parent anymore
        $tree_model->set($parent_iter, 2 => 0);
        foreach my $dir_entry (all($dir)) {
            my $entry_path = $dir . "/" . $dir_entry;
            if (-d $entry_path || $dir_entry =~ /\.(k|)o(\.gz)?$/) {
                $entry_path =~ s|//|/|g;
                my $iter = $tree_model->append_set($parent_iter, [ 0 => $dir_entry, 1 => $entry_path, 2 => 
has_sub_trees($entry_path) ]);
                #- hackery for partial displaying of trees, used in rpmdrake:
                #- if leaf is void, we may create the parent and one child (to have the [+] in front of the 
parent in the ctree)
                #- though we use '' as the label of the child; then rpmdrake will connect on tree_expand, and 
                #- the first child has '' as the label, it will remove the child and add all the "right" 
                $tree_model->append_set($iter, [ 0 => '' ]) if has_sub_trees($entry_path);
    $tree->expand_row($path, 0);


Attachment: drakfloppy
Description: Text document


Attachment: 702_drakfloppy_browsing.diff
Description: Text Data

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