diff options
author | Eric Wong <e@80x24.org> | 2014-05-01 02:30:00 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2014-05-01 02:30:00 +0000 |
commit | 0b271e70401bd7c059d10e2ec8fc802cf0aa9838 (patch) | |
tree | 61ef65d6ce15db3891dd45ce300b87a967512ff8 /lib | |
parent | 65a86d7fbf0f07dbbca2d4c5d9d117c28ed38cc7 (diff) | |
download | public-inbox-0b271e70401bd7c059d10e2ec8fc802cf0aa9838.tar.gz |
Thanks to Ask for the patch in https://rt.cpan.org/Public/Bug/Display.html?id=22817
Diffstat (limited to 'lib')
-rw-r--r-- | lib/PublicInbox/Feed.pm | 6 | ||||
-rw-r--r-- | lib/PublicInbox/Thread.pm | 19 | ||||
-rw-r--r-- | lib/PublicInbox/WWW.pm | 2 |
3 files changed, 22 insertions, 5 deletions
diff --git a/lib/PublicInbox/Feed.pm b/lib/PublicInbox/Feed.pm index 6b317ab0..a507cda1 100644 --- a/lib/PublicInbox/Feed.pm +++ b/lib/PublicInbox/Feed.pm @@ -13,8 +13,6 @@ use constant { MAX_PER_PAGE => 25, }; -# FIXME: workaround https://rt.cpan.org/Public/Bug/Display.html?id=22817 - # main function sub generate { my ($class, $args) = @_; @@ -50,7 +48,7 @@ sub generate { sub generate_html_index { my ($class, $args) = @_; - require Mail::Thread; + require PublicInbox::Thread; my $max = $args->{max} || MAX_PER_PAGE; my $feed_opts = get_feedopts($args); @@ -72,7 +70,7 @@ sub generate_html_index { }); $git = undef; # destroy pipes. - my $th = Mail::Thread->new(@messages); + my $th = PublicInbox::Thread->new(@messages); $th->thread; my $html = "<html><head><title>$title</title>" . '<link rel="alternate" title="Atom feed" href="' . diff --git a/lib/PublicInbox/Thread.pm b/lib/PublicInbox/Thread.pm new file mode 100644 index 00000000..a2553da7 --- /dev/null +++ b/lib/PublicInbox/Thread.pm @@ -0,0 +1,19 @@ +# subclass Mail::Thread and use this to workaround a memory leak +# Based on the patch in: https://rt.cpan.org/Public/Bug/Display.html?id=22817 +# License differs from the rest of public-inbox (but is compatible): +# This library is free software; you can redistribute it and/or modify +# it under the same terms as Perl itself. +package PublicInbox::Thread; +use strict; +use warnings; +use base qw(Mail::Thread); +sub _container_class { 'PublicInbox::Thread::Container' } + +package PublicInbox::Thread::Container; +use strict; +use warnings; +use base qw(Mail::Thread::Container); +use Scalar::Util qw(weaken); +sub parent { @_ == 2 ? weaken($_[0]->{parent} = $_[1]) : $_[0]->{parent} } + +1; diff --git a/lib/PublicInbox/WWW.pm b/lib/PublicInbox/WWW.pm index 6d9550b4..649e3cf0 100644 --- a/lib/PublicInbox/WWW.pm +++ b/lib/PublicInbox/WWW.pm @@ -60,7 +60,7 @@ sub run { sub preload { require PublicInbox::Feed; require PublicInbox::View; - require Mail::Thread; + require PublicInbox::Thread; require Email::MIME; require Digest::SHA; require POSIX; |