row-changed handler treepath lifespan
- From: Kevin Ryde <user42 zip com au>
- To: gtk-perl-list gnome org
- Subject: row-changed handler treepath lifespan
- Date: Mon, 07 Jul 2008 10:19:29 +1000
The program below gets for me
signal handler:
$VAR1 = bless( do{\(my $o = 137867656)}, 'Gtk2::TreePath' );
0
mainline:
$VAR1 = bless( do{\(my $o = 137867656)}, 'Gtk2::TreePath' );
GLib-ERROR **: /tmp/buildd/glib2.0-2.16.4/glib/gmem.c:156: failed to allocate 1657472160 bytes at foo.pl line
21.
Aborted
Is the treepath allowed to be kept and used later outside the signal
handler? I know iters have bizarre lifespan rules, but I thought
treepaths were ok (or as ok as anything in the path/iter/model debacle
can be said to be ok! :-).
use strict;
use warnings;
use Gtk2 '-init';
use Data::Dumper;
my $store = Gtk2::ListStore->new ('Glib::String');
my $global_path;
$store->signal_connect (row_changed => sub {
my ($concat, $path, $iter) = @_;
$global_path = $path;
print "signal handler:\n";
print " ",Dumper($global_path);
print " ",$global_path->to_string,"\n";
});
$store->append;
$store->set ($store->get_iter_first, 0 => 'one');
print "mainline:\n";
print " ",Dumper($global_path);
print " ",$global_path->to_string,"\n";
exit 0;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]