From: Matt S Trout Date: Wed, 11 Jul 2012 18:51:39 +0000 (+0000) Subject: prevent premature destruction of proxy objct while an outstanding future exists for it X-Git-Tag: v0.001001~7 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a2d43709dfa7abde4741638259cbc7cbfa90108c;p=scpubgit%2FObject-Remote.git prevent premature destruction of proxy objct while an outstanding future exists for it --- diff --git a/lib/Object/Remote/Connection.pm b/lib/Object/Remote/Connection.pm index 8f4d443..f64ba30 100644 --- a/lib/Object/Remote/Connection.pm +++ b/lib/Object/Remote/Connection.pm @@ -165,12 +165,16 @@ sub send { my ($self, $type, @call) = @_; my $future = CPS::Future->new; + my $remote = $self->remote_objects_by_id->{$call[0]}; unshift @call, $type => $self->_local_object_to_id($future); my $outstanding = $self->outstanding_futures; $outstanding->{$future} = $future; - $future->on_ready(sub { delete $outstanding->{$future} }); + $future->on_ready(sub { + undef($remote); + delete $outstanding->{$future} + }); $self->_send(\@call);