Hi all, I'm having a lot of 'fun' translating some apps from FreeBSD to Debian, and the latest oddity I'm kind of stumped at.
On the old FreeBSD system, gtk-2.10.9_1 is installed, and perl/Gtk2 1.141 is installed. On the new Debian system, gtk-2.12.12 is installed, and perl/Gtk2 1.190 is installed. This particular app has a Gtk2::ComboBox that, on startup, selects the item the user previously had selected last time it was opened. This is done with: # $wid contains the Gtk2::ComboBox, which already has a filled in model my $mod = $wid->get_model; my $path = undef; $mod->foreach(sub { my ($model, $tpath, $iter, $lookfor) = @_; return 0 if $model->get($iter, 1) != $lookfor; $path = $tpath; return 1; }, "STORED_USER_SELECTION"); $path = Gtk2::TreePath->new(0) if not defined $path; $path = $mod->get_iter($path); $wid->set_active_iter($path); This worked perfectly well on the old system, but on the new system it complains about $path being undef on the "$wid->set_active_iter($path)" line. After digging around, I've discovered that no matter what, $mod->get_iter($path) ALWAYS returns undef. A little further digging suggests this is because Gtk2::TreePath on the new system is completely broken. For instance, if I change the code to: # $wid contains the Gtk2::ComboBox which already has a filled in model my $mod = $wid->get_model; my $path = undef; $mod->foreach(sub { my ($model, $tpath, $iter, $lookfor) = @_; return 0 if $model->get($iter, 1) != $lookfor; $path = $tpath; return 1; }, "STORED_USER_SELECTION"); $path = Gtk2::TreePath->new(0) if not defined $path; print "PATH IS ", $path->to_string, "\n"; # <--- NEW LINE HERE $path = $mod->get_iter($path); $wid->set_active_iter($path); I get a segfault at $path->to_string. If I instead do this: # $wid contains the Gtk2::ComboBox which already has a filled in model my $mod = $wid->get_model; my $path = undef; $mod->foreach(sub { my ($model, $tpath, $iter, $lookfor) = @_; return 0 if $model->get($iter, 1) != $lookfor; $path = $tpath; return 1; }, "STORED_USER_SELECTION"); $path = Gtk2::TreePath->new(0) if not defined $path; print "PATH IS ", join(", ", $path->get_indices, "\n"; # <--- NEW LINE HERE $path = $mod->get_iter($path); $wid->set_active_iter($path); Instead of $path->get_indicies returning a single number (its a linear list after all) I instead get an enormous list of numbers that after a minute or so of printing out I eventually have to CTRL-C to stop. The segfault and the near-endless list of numbers suggests to me there's some bad memory management going on in there, which I assume $mod->get_iter($path) is masking (an eval or something?) and just defaulting to undef, which causes $wid->set_active_iter($path) to complain. So - in lieu of this being fixed (which I hope it will anyway), can anyone give me a workaround example of setting a combo box to display the item that matches a known string? TIA, MB _______________________________________________ gtk-perl-list mailing list gtk-perl-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-perl-list