From 747a1feb2d49d2dba85f997fa2f4542a17800331 Mon Sep 17 00:00:00 2001 From: groditi Date: Tue, 11 Nov 2008 21:08:20 +0000 Subject: fix leaks via make_context_closure --- lib/Reaction/UI/Controller.pm | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib/Reaction/UI/Controller.pm') diff --git a/lib/Reaction/UI/Controller.pm b/lib/Reaction/UI/Controller.pm index 76b562e..fc2f597 100644 --- a/lib/Reaction/UI/Controller.pm +++ b/lib/Reaction/UI/Controller.pm @@ -7,6 +7,7 @@ use base qw( ); use Reaction::Class; +use Scalar::Util 'weaken'; sub push_viewport { my $self = shift; @@ -73,6 +74,13 @@ sub redirect_to { $c->res->redirect($uri); } +sub make_context_closure { + my($self, $closure) = @_; + my $ctx = $self->context; + weaken $ctx; + return sub { $closure->($ctx, @_) }; +} + 1; __END__; -- cgit v1.2.3-54-g00ecf