--- dom.pl.orig 2010-01-13 23:54:13.000000000 +0100 +++ dom.pl 2010-01-13 23:55:08.000000000 +0100 @@ -109,7 +109,7 @@ sub new { my ($node) = @_ or croak "Usage: ${class}->new(node)"; my $self = $class->SUPER::new(); - $self->{stam} = 4; # Random value + $self->{stamp} = 4; # Random value $self->{node} = $node; $self->{iters} = {}; $self->{types} = [ 'Glib::Scalar', 'Glib::String' ]; @@ -241,17 +241,12 @@ sub get_node { and ! defined $iter->[3] ; - my $address = $iter->[1]; - if (! $address) { - Carp::cluck "Iter has no address: ", iter_dumper($iter); - return undef; - } - - my $node = $self->{iters}{$address}; + my $node = $iter->[2]; if (! $node) { - Carp::cluck "Iter has no node at address $address: ", iter_dumper($iter); + Carp::cluck "Iter has no node: ", iter_dumper($iter); return undef; } + return $node; } @@ -261,11 +256,10 @@ sub new_iter { return undef unless $node; - my $address = refaddr $node; - $self->{iters}{$address} = $node; - # The first slot is for the stamp, the second slot is assumed to be an int by - # the perl bindings the other 2 slots are volatile nothing there survives. - return [ $self->{stamp}, $address, undef, undef ]; + # We need to keep $node alive ourselves, as the iter doesn't do it. So + # stuff into $self under its path. + $self->{iters}{$node->nodePath} = $node; + return [ $self->{stamp}, 0, $node, undef ]; }