prevent premature destruction of proxy objct while an outstanding future exists for it
Matt S Trout [Wed, 11 Jul 2012 18:51:39 +0000 (18:51 +0000)]
lib/Object/Remote/Connection.pm

index 8f4d443..f64ba30 100644 (file)
@@ -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);