We have to walk through all the messages after threading
anyways to build the rootset, so we can just delete all
the parent references at that point.
---
 lib/PublicInbox/SearchThread.pm | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/lib/PublicInbox/SearchThread.pm b/lib/PublicInbox/SearchThread.pm
index 05de9ec..003a8d1 100644
--- a/lib/PublicInbox/SearchThread.pm
+++ b/lib/PublicInbox/SearchThread.pm
@@ -33,7 +33,7 @@ sub thread {
        my $self = shift;
        _add_message($self, $_) foreach @{$self->{messages}};
        my $id_table = delete $self->{id_table};
-       $self->{rootset} = [ grep { !$_->{parent} } values %$id_table ];
+       $self->{rootset} = [ grep { !delete $_->{parent} } values %$id_table ];
 }
 
 sub _get_cont_for_id ($$) {
@@ -90,7 +90,6 @@ package PublicInbox::SearchThread::Msg;
 use strict;
 use warnings;
 use Carp qw(croak);
-use Scalar::Util qw(weaken);
 
 sub new {
        bless {
@@ -112,7 +111,7 @@ sub add_child {
                delete $parent->{children}->{$cid};
        }
 
-       weaken($child->{parent} = $self);
+       $child->{parent} = $self;
 }
 
 sub has_descendent {
-- 
EW


Reply via email to