[html-formfu] Found leak in HTML::FormFu::Localize

Matthias Dietrich perl at rainboxx.de
Thu Sep 29 14:43:15 GMT 2011


Hi,

I went through my Catalyst app with CatalystX::LeakChecker to find possible leaks.  CatalystX::LeakChecker showed a leak within FormFu, the following patch should fix it (tests pass, my app works, CatalystX::LeakChecker is happy too).

I'd be happy to push it directly into the FormFu master on github, if no one votes against it.

Matthias



diff --git a/lib/HTML/FormFu/Localize.pm b/lib/HTML/FormFu/Localize.pm
index 5a7f398..8b46e01 100644
--- a/lib/HTML/FormFu/Localize.pm
+++ b/lib/HTML/FormFu/Localize.pm
@@ -5,7 +5,7 @@ use strict;
 use HTML::FormFu::Util qw( require_class );
 use List::MoreUtils qw( any );
 use List::MoreUtils qw( pairwise );
-use Scalar::Util qw( blessed );
+use Scalar::Util qw( weaken blessed );
 use Exporter qw( import );
 use Carp qw( croak );
 
@@ -83,6 +83,7 @@ sub add_localize_object {
             localize_object     => $localize_object,
             dies_on_missing_key => $dies_on_missing_key,
             };
+        weaken @{ $self->{localize_data} }[-1]->{localize_object};
     }
 
     return $self;




-- 
rainboxx Software Engineering
Matthias Dietrich

rainboxx Matthias Dietrich   |  Phone: +49 7141 / 2 39 14 71
Königsallee 43               |  Fax  : +49 3222 / 1 47 63 00 
71638 Ludwigsburg            |  Mobil: +49  151 / 50 60 78 64
                             |  WWW  :  http://www.rainboxx.de

CPAN: http://search.cpan.org/~mdietrich/
XING: https://www.xing.com/profile/Matthias_Dietrich18
GULP: http://www.gulp.de/profil/rainboxx.html







More information about the HTML-FormFu mailing list