about summary refs log tree commit homepage
path: root/lib/PublicInbox/Thread.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2014-05-01 02:30:00 +0000
committerEric Wong <e@80x24.org>2014-05-01 02:30:00 +0000
commit0b271e70401bd7c059d10e2ec8fc802cf0aa9838 (patch)
tree61ef65d6ce15db3891dd45ce300b87a967512ff8 /lib/PublicInbox/Thread.pm
parent65a86d7fbf0f07dbbca2d4c5d9d117c28ed38cc7 (diff)
downloadpublic-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/PublicInbox/Thread.pm')
-rw-r--r--lib/PublicInbox/Thread.pm19
1 files changed, 19 insertions, 0 deletions
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;