1 # subclass Mail::Thread and use this to workaround a memory leak
2 # Based on the patch in: https://rt.cpan.org/Public/Bug/Display.html?id=22817
3 # License differs from the rest of public-inbox (but is compatible):
4 # This library is free software; you can redistribute it and/or modify
5 # it under the same terms as Perl itself.
6 package PublicInbox::Thread;
9 use base qw(Mail::Thread);
11 if ($Mail::Thread::VERSION <= 2.55) {
12 eval q(sub _container_class { 'PublicInbox::Thread::Container' });
17 (eval { $a->topmost->message->header('X-PI-TS') } || 0) <=>
18 (eval { $b->topmost->message->header('X-PI-TS') } || 0)
24 (eval { $b->topmost->message->header('X-PI-TS') } || 0) <=>
25 (eval { $a->topmost->message->header('X-PI-TS') } || 0)
29 package PublicInbox::Thread::Container;
32 use base qw(Mail::Thread::Container);
33 use Scalar::Util qw(weaken);
34 sub parent { @_ == 2 ? weaken($_[0]->{parent} = $_[1]) : $_[0]->{parent} }