Hallo List,
In my Testcase I build a  Form containing a Tree and a Button.
When pressing the Button, the Parameter form pops up depending on the
tree's selection.
When Pressing OK in the Parameter Form tries to change the content of the
current selection in the
tree.
But It seems, that within the callback of the Dialog the tree-iterator is
invalid. I cannot understand why.
Sometimes the script also exits with a segmentation fault
Does anybody see the bug in the provided testcase code ?
The Error Code is 
Gtk-CRITICAL **: gtk_tree_store_set_value: assertion `VALID_ITER (iter,
tree_store)' failed at ./testcase.pl line 64
The code is below. Thank you for your help
--------------
#! /usr/bin/env perl
# Use the TRUE and FALSE constants exported by the Glib module.
use Glib qw/TRUE FALSE/;
use Gtk2 '-init';
use strict;
use constant COLUMN_TEXT => 0;
our $treemodel = Gtk2::TreeStore->new('Glib::String');
my $treeview=Gtk2::TreeView->new($treemodel);
my $window = Gtk2::Window->new('toplevel');
my $handle;
$handle=$treemodel->append(undef);
$treemodel->set($handle,0,"main");
$handle=$treemodel->append($handle);
$treemodel->set($handle,0,"sub");
#--------------------------------
my $param_dialog;
sub editparameter_callback
{
        my $treeselection=$treeview->get_selection;
        $treeselection->selected_foreach (sub{ 
        my ($model,$path,$iter) = _;
        my @fields;
        push @fields, ["Description","parameter","option1","option2" ];
        my $contentbox = Gtk2::Table->new(FALSE, scalar @fields,2);
        my $row=0;
        my $field;
        foreach $field (@fields)
        {
                my $combobox=Gtk2::ComboBoxEntry->new_text;
                my @options= $field;
                shift @options;
                my $option;
                foreach $option (@options)
                {
                        $combobox->append_text($option);
                }
                $contentbox->attach_defaults(Gtk2::Label->new($field->[0]),0,1,$row,$row+1);
                $contentbox->attach_defaults($combobox,1,2,$row,$row+1);
                $row=$row+1;
        }
        $param_dialog=Gtk2::Dialog->new("Parameter
Editor",$window,"destroy-with-parent");
        $param_dialog->add_buttons(
                'gtk-ok' => 'ok',
                'gtk-cancel' => 'cancel'
        );
        $param_dialog->signal_connect('response', sub
        {
                print "before\n";
                $model->set($iter,0,"text");
                print "after\n";
                $param_dialog->hide;
        });
        $param_dialog->get_content_area->add($contentbox);
        $param_dialog->show_all;
        });
}
my $editparameter_button = Gtk2::Button->new("Press me");
$editparameter_button->signal_connect(clicked => \&editparameter_callback,
$window);
$treeview->insert_column_with_attributes( -1, "Header1",
Gtk2::CellRendererText->new(), text => 0);  
my $contentbox = Gtk2::VBox->new(FALSE, 0);
$contentbox->add($treeview);
$contentbox->pack_end($editparameter_button,FALSE,FALSE,0);
$window->add($contentbox);
$window->set_border_width(10);
$window->show_all;
Gtk2->main;
0;
Attachment:
testcase.pl
Description: Binary data